yii2 为控制台 cron 作业启用 Imagine
yii2 Enable Imagine for console cron jobs
我正在使用一段代码
protected function generateBgThumbs($release,$promo) {
$thumb = ($promo->catalog_based)
?Yii::$app->params['promo_cover_thumb_upload_path'].DIRECTORY_SEPARATOR.'600x600_' . $release->cover_file
:Yii::$app->params['release_thumbs_upload'].DIRECTORY_SEPARATOR.'600x600_' . $release->cover_file;
$source = ($promo->catalog_based)
?Yii::$app->params['promo_cover_upload_path'] .DIRECTORY_SEPARATOR. $release->cover_file
:Yii::$app->params['release_cover_upload'] .DIRECTORY_SEPARATOR. $release->cover_file;
if (!file_exists($thumb)) {
if ($release->cover_file != '' && file_exists($source)) {
Image::getImagine()
->open($source)
->thumbnail(new Box(600, 600))
->save($thumb, ['quality' => 90]);
}else{
$this->output.="Not Generated";
}
}
}
为我的 yii2 应用程序前端中的图像生成缩略图,现在我有一些 cron 作业,我 运行 通过 Cli,当我使用相同的方法生成缩略图时,它给我以下错误
Your system does not support any of these drivers: gmagick,imagick,gd2
知道这是否与我的 cli/php.ini
文件有关吗?或者别的什么,是的,我正在使用语句
use yii\imagine\Image;
use Imagine\Gd;
在我的脚本文件的顶部,我安装了 Ubuntu。
我在上次系统更新后为 cli 模式安装了 php 7 我通过输入 php -v
检查并将其恢复为 php 5.7
之后一切正常
我正在使用一段代码
protected function generateBgThumbs($release,$promo) {
$thumb = ($promo->catalog_based)
?Yii::$app->params['promo_cover_thumb_upload_path'].DIRECTORY_SEPARATOR.'600x600_' . $release->cover_file
:Yii::$app->params['release_thumbs_upload'].DIRECTORY_SEPARATOR.'600x600_' . $release->cover_file;
$source = ($promo->catalog_based)
?Yii::$app->params['promo_cover_upload_path'] .DIRECTORY_SEPARATOR. $release->cover_file
:Yii::$app->params['release_cover_upload'] .DIRECTORY_SEPARATOR. $release->cover_file;
if (!file_exists($thumb)) {
if ($release->cover_file != '' && file_exists($source)) {
Image::getImagine()
->open($source)
->thumbnail(new Box(600, 600))
->save($thumb, ['quality' => 90]);
}else{
$this->output.="Not Generated";
}
}
}
为我的 yii2 应用程序前端中的图像生成缩略图,现在我有一些 cron 作业,我 运行 通过 Cli,当我使用相同的方法生成缩略图时,它给我以下错误
Your system does not support any of these drivers: gmagick,imagick,gd2
知道这是否与我的 cli/php.ini
文件有关吗?或者别的什么,是的,我正在使用语句
use yii\imagine\Image;
use Imagine\Gd;
在我的脚本文件的顶部,我安装了 Ubuntu。
我在上次系统更新后为 cli 模式安装了 php 7 我通过输入 php -v
检查并将其恢复为 php 5.7
之后一切正常