定制 letyii/yii2-imagecache 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

letyii/yii2-imagecache

最新稳定版本:v1.0.1

Composer 安装命令:

composer require letyii/yii2-imagecache

包简介

Image cache for yii2

README 文档

README

Features

  • Image resize on demand
  • Imagick support
  • GD support
  • Amazon S3 support

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require "letyii/yii2-imagecache" "*"

or add

"letyii/yii2-imagecache": "*"

to the require section of your application's composer.json file.

Config

'components' => [
    ...
    'imageCache' => [
        'class' => 'letyii\imagecache\imageCache',
        'cachePath' => '@app/uploads/cache',
        'cacheUrl' => '@web/uploads/cache',
    ],
]

Usage Example

echo Yii::$app->imageCache->imgSrc('@app/uploads/test.jpg', 'x200');
// Output: /your-app/uploads/cache/x200/.../test.jpg

echo Yii::$app->imageCache->img('@app/uploads/test.jpg', '100x');
// Output: <img src="/your-app/uploads/cache/100x/.../test.jpg" alt="" />

echo Yii::$app->imageCache->img('@app/uploads/test.jpg', '100x150', ['class'=>'test', 'alt' => 'Test image']);
// Output: <img src="/your-app/uploads/cache/100x120/.../test.jpg" alt="" class="img" alt="Test image" />

统计信息

  • 总下载量: 1.55k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 3
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-04-24