bluehe / yii2-imagine
Yii框架的Imagine集成
2.1.0
2016-11-03 19:28 UTC
Requires
- imagine/imagine: ~0.6.0
- yiisoft/yii2: ~2.0.0
This package is not auto-updated.
Last update: 2024-09-28 00:04:10 UTC
README
此扩展添加了最常见的图像功能,并且作为Imagine图像处理库的包装器,用于Yii框架2.0。
有关许可证信息,请查看LICENSE文件。
安装
安装此扩展的首选方式是通过composer。
运行以下命令之一:
php composer.phar require --prefer-dist yiisoft/yii2-imagine
或者添加以下内容到你的composer.json文件的require部分。
"yiisoft/yii2-imagine": "~2.0.0"
使用 & 文档
此扩展是Imagine的包装器,并添加了最常用的图像处理方法。
以下示例展示了如何使用此扩展:
use yii\imagine\Image; // frame, rotate and save an image Image::frame('path/to/image.jpg', 5, '666', 0) ->rotate(-8) ->save('path/to/destination/image.jpg', ['jpeg_quality' => 50]);
请注意,每个Image方法返回一个\Imagine\Image\ImageInterface的实例。这意味着你可以使用包含在Imagine库中的方法。