Yii の EasyImage 拡張機能をダウンロードして画像をトリミングしましたが、画像を初期化しようとすると、次の致命的なエラーが発生します。
Fatal error: Call to undefined method Image::factory() in C:\Users\Daniel\Documents\GitHub\askengine\protected\extensions\yii-easyimage\EasyImage.php on line 41
理由がわかりません。
私のコントローラー:
Yii::import('ext.yii-easyimage.EasyImage');
$image = new EasyImage("avatar/".$fileName);
$image->crop($_POST['w'], $_POST['h'], $_POST['x1'], $_POST['y1']);
$image->save();
EasyImage クラス _construct():
public function __construct($file = null, $driver = null)
{
if ($file) {
return $this->_image = Image::factory($this->detectPath($file), $driver ? $driver : $this->driver);
}
}
そして Image.php :
public static function factory($file, $driver = NULL)
{
if ($driver === NULL) {
// Use the default driver
$driver = Image::$default_driver;
}
// Set the class name
$class = 'Image_' . $driver;
return new $class($file);
}
Image.php を直接使用しようとしましたが、失敗しました:
Fatal error: Call to undefined method Image::factory() in C:\Users\Daniel\Documents\GitHub\askengine\protected\controllers\ImageController.php on line 60