Comments (9)
@puppyLyx @dersonsena
just change the version of imagine/imagine can walk around this issue temporary
like that:
- add a fork repositories to composer.json of your project
"repositories": [
{"type": "vcs", "url": "https://github.com/JasLin/yii2-imagine"}
],
- composer require
composer require yiisoft/yii2-imagine:dev-upgrade-imagine-to-version0.7.x
from yii2-imagine.
Should be resolved with dependency upgrade.
See 5e52564
from yii2-imagine.
could you provide a stack trace for the error?
from yii2-imagine.
my code:
Image::thumbnail( $newFile,
self::THUMB_WIDTH ,
self::THUMB_HEIGHT, ManipulatorInterface::THUMBNAIL_INSET)
->save( $newFile,['quality' => 80]);
error:
Exception
Error
Call to undefined method Imagick::setImageOpacity()
1. in /Users/puppy/dev/web/php/projects/blog/vendor/imagine/imagine/lib/Imagine/Imagick/Imagine.php at line 82
73747576777879808182838485868788899091 $pixel = new \ImagickPixel((string) $color);
$pixel->setColorValue(\Imagick::COLOR_ALPHA, $color->getAlpha() / 100);
$imagick = new \Imagick();
$imagick->newImage($width, $height, $pixel);
$imagick->setImageMatte(true);
$imagick->setImageBackgroundColor($pixel);
if (version_compare('6.3.1', $this->getVersion($imagick)) < 0) {
$imagick->setImageOpacity($pixel->getColorValue(\Imagick::COLOR_ALPHA));
}
$pixel->clear();
$pixel->destroy();
return new Image($imagick, $palette, new MetadataBag());
} catch (\ImagickException $e) {
throw new RuntimeException('Could not create empty image', $e->getCode(), $e);
}
2. in /Users/puppy/dev/web/php/projects/blog/vendor/yiisoft/yii2-imagine/BaseImage.php at line 245 – Imagine\Imagick\Imagine::create(Imagine\Image\Box, Imagine\Image\Palette\Color\RGB)
239240241242243244245246247248249250251 }
$palette = new RGB();
$color = $palette->color(static::$thumbnailBackgroundColor, static::$thumbnailBackgroundAlpha);
// create empty image to preserve aspect ratio of thumbnail
$thumb = static::getImagine()->create($thumbnailBox, $color);
// calculate points
$startX = 0;
$startY = 0;
if ($size->getWidth() < $width) {
$startX = ceil($width - $size->getWidth()) / 2;
3. in /Users/puppy/dev/web/php/projects/blog/backend/models/Artical.php at line 89 – yii\imagine\BaseImage::thumbnail('/Users/puppy/dev/web/php/project...', 300, 300, 'inset')
83848586878889909192939495
// 删除旧的图片
Chu::unlink( $oldLogo );
Image::thumbnail( $newFile,
self::THUMB_WIDTH ,
self::THUMB_HEIGHT, ManipulatorInterface::THUMBNAIL_INSET)
->save( $newFile,['quality' => 80]);
return true;
}
public function delete(){
4. in /Users/puppy/dev/web/php/projects/blog/backend/controllers/ArticalController.php at line 117 – backend\models\Artical::save()
111112113114115116117118119120121122123 * @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('update', [
'model' => $model,
'categorys' => self::formatCategory(),
]);
5. backend\controllers\ArticalController::actionUpdate('2')
6. in /Users/puppy/dev/web/php/projects/blog/vendor/yiisoft/yii2/base/InlineAction.php at line 57 – call_user_func_array([backend\controllers\ArticalController, 'actionUpdate'], ['2'])
7. in /Users/puppy/dev/web/php/projects/blog/vendor/yiisoft/yii2/base/Controller.php at line 156 – yii\base\InlineAction::runWithParams(['r' => 'artical/update', 'id' => '2'])
8. in /Users/puppy/dev/web/php/projects/blog/vendor/yiisoft/yii2/base/Module.php at line 523 – yii\base\Controller::runAction('update', ['r' => 'artical/update', 'id' => '2'])
9. in /Users/puppy/dev/web/php/projects/blog/vendor/yiisoft/yii2/web/Application.php at line 102 – yii\base\Module::runAction('artical/update', ['r' => 'artical/update', 'id' => '2'])
10. in /Users/puppy/dev/web/php/projects/blog/vendor/yiisoft/yii2/base/Application.php at line 380 – yii\web\Application::handleRequest(yii\web\Request)
11. in /Users/puppy/dev/web/php/projects/blog/www/admin/index.php at line 17 – yii\base\Application::run()
11121314151617 require(__DIR__ . '/../../common/config/main.php'),
require(__DIR__ . '/../../common/config/main-local.php'),
require(__DIR__ . '/../../backend/config/main.php'),
require(__DIR__ . '/../../backend/config/main-local.php')
);
(new yii\web\Application($config))->run();
$_GET = [
'r' => 'artical/update',
'id' => '2',
];
$_POST = [
'_csrf-backend' => 'Qm5UcElHLkcLOCddGB4YEy4kBz4fc3wyIxoABCAqSQAOFzsFJS1sAA==',
'Artical' => [
'name' => 'URL 管理',
'thumb' => '',
'category' => '1',
'recommend' => '1',
'remark' => 'Yii中的URL管理概念很简单。URL管理基于这样的前提:应用程序的每个地方都使用内部路由和参数。框架然后将路由解释为URLs,或者相反,这取决于URL管理的配置。这样的方式允许你通过修改一个配置项就可以更改整站的URL行为,而不需要改动任',
'content' => '<p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 10px; color: rgb(51, 51, 51); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; white-space: normal; background-color: rgb(255, 255, 255);">Yii中的URL管理概念很简单。URL管理基于这样的前提:应用程序的每个地方都使用内部路由和参数。框架然后将路由解释为URLs,或者相反,这取决于URL管理的配置。这样的方式允许你通过修改一个配置项就可以更改整站的URL行为,而不需要改动任何的代码。</p><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 10px; color: rgb(51, 51, 51); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; white-space: normal; background-color: rgb(255, 255, 255);"> </p><h2 style="box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: 500; line-height: 1.1; color: rgb(51, 51, 51); margin-top: 5px; margin-bottom: 10px; font-size: 30px; white-space: normal; background-color: rgb(255, 255, 255);">内部路由</h2><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 10px; color: rgb(51, 51, 51); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; white-space: normal; background-color: rgb(255, 255, 255);">Yii应用处理的内部路由通常指的是路由及参数。 每个控制器及其动作都有对应的内部路由,比如<code style="box-sizing: border-box; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-radius: 4px;">site/index</code> 或 <code style="box-sizing: border-box; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-radius: 4px;">user/create</code>。 前一例中的<code style="box-sizing: border-box; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-radius: 4px;">site</code> 被称为 <em style="box-sizing: border-box;">controller ID</em> (控制器ID),而 <code style="box-sizing: border-box; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-radius: 4px;">index</code> 被称为 <em style="box-sizing: border-box;">action ID</em>(动作ID)。 第二例中的<code style="box-sizing: border-box; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-radius: 4px;">user</code> 是控制器ID,<code style="box-sizing: border-box; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-radius: 4px;">create</code> 是动作ID。如果控制器在 <em style="box-sizing: border-box;">module</em> (模块)内部, 内部路由则以模块ID开头,比如 <code style="box-sizing: border-box; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-radius: 4px;">blog/post/index</code> 是 blog 模块的 post 控制器的 index 动作。</p><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 10px; color: rgb(51, 51, 51); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; white-space: normal; background-color: rgb(255, 255, 255);"> </p><h2 style="box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: 500; line-height: 1.1; color: rgb(51, 51, 51); margin-top: 5px; margin-bottom: 10px; font-size: 30px; white-space: normal; background-color: rgb(255, 255, 255);">创建 URLs</h2><p><br/></p>',
],
];
$_FILES = [
'Artical' => [
'name' => [
'thumb' => '叼盘子.jpg',
],
'type' => [
'thumb' => 'image/jpeg',
],
'tmp_name' => [
'thumb' => '/private/var/tmp/phpg5V2on',
],
'error' => [
'thumb' => 0,
],
'size' => [
'thumb' => 24640,
],
],
];
$_COOKIE = [
'_csrf-backend' => '2a597365e1d024b8f1dd985e409cf7f21953796c0c99bb40f80c473385018ed5a:2:{i:0;s:13:"_csrf-backend";i:1;s:32:"IVs-QY6TlJSNV4RuatTtimgGLyouljBG";}',
'BACKENDSESSID' => '3iu9r5c6ugtcg1gon63cnhvi71',
'_backendIdentity' => 'bb2148dc3f713b4d0ca2cf9b26e0c3d6b903042a1d7d399a7941dd1ac3de0736a:2:{i:0;s:16:"_backendIdentity";i:1;s:46:"[1,"sn96DTrT-UDJ-TxKmUd6YKB8bM-b6yVU",2592000]";}',
'advanced-frontend' => '2p6i5du3jk9h2qrh9ifuavh8q7',
'_csrf-frontend' => '2606909b2d2364ddb12451ede2ba5693314ee5e8e4c007497a0e236dd75b7718a:2:{i:0;s:14:"_csrf-frontend";i:1;s:32:"mRZBbtwbYSYSkrTQ7LTHqm2psYu_3XNj";}',
];
$_SESSION = [
'__flash' => [],
'__id' => 1,
'user.session.expire' => 1489587994,
'user.session.token.password:' => '9120c54a6f083916060efa334c65756d',
];
Yii Framework
2017-03-15, 21:26:34
nginx/1.11.9
Yii Framework/2.0.11.2
2.0.11.2 PHP 7.0.15 Status 500 Route artical/update Log 34 1 Time 899 ms Memory 6.511 MB DB 8 122 ms User 1
from yii2-imagine.
@samdark please update imagine/imagine library to 0.7.1. It was fixed there.
from yii2-imagine.
@samdark I'm have the same problem! I seen that the current version of the imagine is incompatibly. The imagine version has been changed ?
from yii2-imagine.
No, not yet.
from yii2-imagine.
Having this issue after upgrading to php 7.2.
from yii2-imagine.
Reletes to #46
from yii2-imagine.
Related Issues (20)
- UnexpectedValueException when installing package HOT 2
- update imagine/imagine version to 0.7? HOT 4
- yii2queue run job ,yii2-imagine not work;
- add feature to crop image durring resizing to avoid visual deffects HOT 1
- Ignore `OutOfBoundsException` error when watermark grower of source image HOT 1
- supplied resource is not a valid stream resource HOT 2
- update imagine/imagine version to 1.1.0? HOT 2
- Does not work with PECL 3.4.4 and Imagine 6 HOT 1
- php 7.3.6 segmentation fault HOT 2
- The watermarking of a watermarked image will be smaller. HOT 3
- ignore the cyrillic alphabet in label HOT 2
- Update or copy image and preserve exif meta data HOT 2
- ExifMetadataReader::extractFromFile() does not return EXIF data HOT 1
- Change color depth in png images after saving HOT 2
- Protected Static Method getThumbnailBox HOT 1
- Using S3 Containers HOT 9
- update github folder link
- update docs folder link
- update src folder link
- update root folder links
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yii2-imagine.