mirocow/yii2-imagecache Yii2 imagecache extension

yii2-imagecache

Install

$ composer require --prefer-dist mirocow/yii2-imagecache

Configuration

Nginx

server {
   location ~ /images/\w+/.*?\.(png|jpg|jpeg|gif) {
       # Redirect everything that isn't a real file to index.php
       try_files $uri $uri/ /index.php$is_args$args;
   }
}

Yii2 config

return [
    'components' => [
        'urlManager' => [
            'baseUrl' => 'http://site.com',
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            //'cache' => 'cache',
            'rules' => [
                'GET /images/<preset:\w+>/<filename:.*?>' => 'mirocow/imagecache',
            ],
        ],
        'image' => [
            'class' => 'mirocow\imagecache\components\Image',
            'presets' => [
                '200x200' => [
                    'cachePath'=>'@webroot/images/200x200',
                    'actions'=>[
                    'image_x' => 200,
                    'image_y' => 200,
                    'image_ratio_crop' => true,
                    'image_resize' => true,
                    //'image_convert' => 'png',
                ],
            ],
        ],
    ],
    'modules' => [
        'imagecache' => [
            'class' => 'mirocow\imagecache\Module',
        ],
    ],
];

Presets

Libraries

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

No stable releases.

Comments



No stable releases.



MIT license
Stats
2 github stars & 3 github forks
0 downloads in the last day
0 downloads in the last 30 days
1 total downloads