插件cakephp-imagine-plugin实现错误

时间:2019-01-21 20:16:49

标签: cakephp

我正在使用Cakephp 3.6,在实现插件(https://github.com/burzum/cakephp-imagine-plugin/)时遇到问题

看起来它应该很容易实现,但是我无法弄清楚,而且可能遗漏了一些明显的东西。

  

以布尔值调用成员函数processImage()

按照安装说明,我将以下代码添加到config/bootstrap.php

Plugin::load('Burzum/Imagine');
Configure::write('Imagine.salt', '$ntCdb-nQuImAnht3cC9PF4Q8P-bOXSppm^c3qcq');

我在src / Model / Table / PhotosTable.php中:

namespace App\Model\Table;
use Cake\ORM\Table;
use Cake\Validation\Validator;

class PhotosTable extends Table
{
    public $name='Photo';
    public $tablePrefix = '';
    ...

    public function initialize(array $config)
    {
        $this->addBehavior('Burzum/Imagine.Imagine');
    }

最后,我从插件的文档中向应用程序的src/Controller/Controller.php添加了简单的示例函数:

    public function photos($id,$title)    
    {
        $details=$this->Photos->photoDetails($id);

        $imageOperations = array(
            'thumbnail' => [
                'height' => 450,
                'width' => 450
            ],
        );

        $this->Image->processImage(
            BASE_URL.'image/'.$details->photo_name,
            BASE_URL.'image/thumb_'.$details->photo_name,
            [],
            $imageOperations
        );

        // ...

0 个答案:

没有答案