axelpal/yii2-easyimage
最新稳定版本:1.0.4
Composer 安装命令:
composer require axelpal/yii2-easyimage
包简介
Image Component for Yii2
README 文档
README
Image Component for Yii2
This extension is base on yii-easyImage, used for Yii2.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require axelpal/yii2-easyImage
or add
"axelpal/yii2-easyImage": "^1.0"
to the require section of your composer.json file.
Usage
Once the extension is installed, simply modify your application configuration as follows:
return [ ... 'components' => [ .... 'easyImage' => [ 'class' => 'cliff363825\image\EasyImage', 'driver' => 'GD', 'quality' => 100, 'cachePath' => '/easyimage/', 'cacheTime' => 2592000, 'retinaSupport' => false, 'basePath' => '@webroot', 'baseUrl' => '@web', ] ], ];
####Parameters
- string
$filerequired - Image file path - string
$driver- Driver:GD,Imagick
ThumbOf
You can create a thumbnail directly in the View:
// Create and autocache
Yii::$app->easyImage->thumbOf('/path/to/image.jpg', ['rotate' => 90]);
// or
Yii::$app->easyImage->thumbOf('image.jpg', ['rotate' => 90], ['class' => 'image']);
// or
Yii::$app->easyImage->thumbOf('image.png', [ 'resize' => ['width' => 100, 'height' => 100], 'rotate' => ['degrees' => 90], 'sharpen' => 50, 'background' => '#ffffff', 'type' => 'jpg', 'quality' => 60, ]);
Note. This method return Html::img()
####Parameters
- string
$filerequired - Image file path - array
$params- Image manipulation methods. See Methods - array
$htmlOptions- options for Html::img()
For full details on usage, see the documentation.
统计信息
- 总下载量: 3.78k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-07-13