Skip to content

drishu/yii2-imagecache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Yii2 Imagecache

the better image cache

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist drishu/yii2-imagecache "*"

or add

"drishu/yii2-imagecache": "*"

to the require section of your composer.json file.

imageCache component config

You should add imageCache component in your application configuration :

$config = [
    'components' => [
      ...
      'imagecache' => [
        'class' => 'drishu\yii2imagecache\ImageCache',
        // the below paths depend very much on your image upload setup
        'sourcePath' => Yii::getAlias('@base'), // base path to your uploads dir
        'cachePath' => '/data', // relative path to your uploads dir
      ],
      ...
    ],
];

Usage

In your view, controller, component, etc. just call :

<?= Html::img(Yii::$app->imagecache->get($image->path, '0x160'))?>```

About

work in progress

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages