我使用 cakephp 3.0.x-dev,我想使用插件 cakephp-imagine-plugin ( https://github.com/burzum/cakephp-imagine-plugin/tree/3.0 )。
当我使用这个插件时,我的 cakephp 视图中出现以下错误
错误:未安装 imagick
我的控制器看起来像
namespace App\Controller;
use App\Controller\AppController;
use Imagine\Imagick\Imagine;
class AccueilController extends AppController {
public function index() {
$directory = 'webroot'.DS.'img'.DS.'Carousel'.DS;
//get all image
$images = glob($directory . "*.{jpg,JPG,jpeg,JPEG,png,PNG}",GLOB_BRACE);
// resize image if necessary.. format(900x500)
$height = 500;
$width = 900;
foreach($images as $image)
{
$image = new Imagine();
//.. do some processing operation
}
// send data to the view
$this->set('images', $images);
}
}
感谢 php composer.phar,我已经安装了插件视图。composer.json 文件如下所示:
{
"name": "cakephp/app",
"description": "CakePHP skeleton app",
"homepage": "http://cakephp.org",
"type": "project",
"license": "MIT",
"require": {
"php": ">=5.4.16",
"cakephp/cakephp": "3.0.*-dev",
"composer/installers": "*",
"mobiledetect/mobiledetectlib": "2.*",
"cakephp/debug_kit": "3.0.*-dev",
"imagine/imagine": "*",
"composer/installers": "*"
},
"require-dev": {
"d11wtq/boris": "1.0.*"
},
"extra": {
"installer-name" : "Imagine"
},
"suggest": {
"phpunit/phpunit": "Allows automated tests to be run without system-wide install.",
"cakephp/cakephp-codesniffer": "Allows to check the code against the coding standards used in CakePHP."
},
"autoload": {
"psr-4": {
"App\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"App\\Test\\": "tests",
"Cake\\Test\\Fixture\\": "./vendor/cakephp/cakephp/tests/Fixture"
}
},
"scripts": {
"post-install-cmd": "App\\Console\\Installer::postInstall"
},
"config" : {
"bin-dir" : "bin"
},
"minimum-stability" : "dev",
"prefer-stable": true
}
该插件安装在 vendor/imagine/imagine/
我不知道我做错了什么。在此之前我从未使用过作曲家。所以我不确定我在 composer.json 文件中写了什么。有人可以帮助我吗?
问候,
史努比