indicalabs/yii2-imagine

Yii 框架的 Imagine 集成

安装次数: 6

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 94

类型:yii2-extension

2.1.0 2016-11-03 19:28 UTC

This package is auto-updated.

Last update: 2024-09-16 05:29:28 UTC


README

Yii 2 的 Imagine 扩展


此扩展添加了最常见的图像功能,并作为 Imagine 图像处理库的包装器,用于 Yii 框架 2.0

有关许可信息,请查看 LICENSE 文件。

Latest Stable Version Total Downloads Build Status

安装

安装此扩展的首选方法是通过 composer

运行以下命令:

php composer.phar require --prefer-dist yiisoft/yii2-imagine

"yiisoft/yii2-imagine": "~2.1.0"

将以下内容添加到您的 composer.json 文件的 require 部分:

使用 & 文档

此扩展是 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 库中包含的方法。