问题
I am working on crop image module, I need detail of uploaded image so i am using this function
$image = Image::getImagine()->open($path);
$size = $image->getSize();
While using this function it is giving me error
Class 'Imagine\Gd\Imagine' not found
case self::DRIVER_IMAGICK:
if (class_exists('Imagick', false)) {
return new \Imagine\Imagick\Imagine();
}
break;
case self::DRIVER_GD2:
if (function_exists('gd_info')) {
return new \Imagine\Gd\Imagine();
}
break;
default:
throw new InvalidConfigException("Unknown driver: $driver");
}
}
throw new InvalidConfigException("Your system does not support any of these drivers: " . implode(',', (array) static::$driver));
This error comes from it library files
vendor\yiisoft\yii2\imagine\BaseImage.php
How can i solve this issue ? Can anyone please suggest me ?
Namespace is also added
namespace yii\imagine;
use Yii;
use yii\imagine\Image\Box;
use yii\imagine\Image\Color;
use yii\imagine\Image\ImageInterface;
use yii\imagine\Image\ImagineInterface;
use yii\imagine\Image\ManipulatorInterface;
use yii\imagine\Image\Point;
use yii\base\InvalidConfigException;
use yii\base\InvalidParamException;
use yii\helpers\ArrayHelper;
This is library files, i never changed it, i also did composer update, still it is giving me same error
回答1:
could be a namespece access problem try add
use yii\imagine;
to your code
来源:https://stackoverflow.com/questions/33190053/class-imagine-gd-imagine-not-found-in-yii2