maddoger/yii2-imagecache

There is no license information available for the latest version (v1.2.0) of this package.

ImageCache extension for Yii2.

Installs: 78

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 1

Open Issues: 0

Type:yii2-extension

v1.2.0 2015-04-14 15:22 UTC

This package is not auto-updated.

Last update: 2024-04-27 15:15:11 UTC


README

Installation

The preferred way to install this extension is through composer.

Either run

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

or add

"maddoger/yii2-imagecache": "*"

to the require section of your composer.json file.

#Component:

'imageCache' => [
    'class' => 'maddoger\imagecache\ImageCache',
    'generateWithUrl' => false,
    'actionSavesFile' => false,

    //Avatar
    'presets' => [
        '100x100' => [
            'fit' => [
                'width' => 100,
                'height' => 100,
            ],
        ],
        '200x' => [
            'thumbnail' => [
                'width' => 200,
                'height' => 200,
            ],
        ],
    ],
],

#For server generation

##In controller:

public function actions()
    {
        return [
            'imagecache' => [
                'class' => 'maddoger\imagecache\ImageAction',
            ],
        ];
    }

##In configuration:

'urlManager' => [
    ...
    'rules' => [
        ...
        'static/ic/<img:.*?>' => 'site/imagecache',
        ...
    ],
    ...
],

##.htaccess

RewriteEngine On

RedirectMatch 403 /\.
RedirectMatch 403 /\.htaccess$

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/static/ic/*
RewriteRule ^(.*)$  ../index.php [QSA,L]

#Faster generation

##Standalone php script

Use files from server folder.

For faster generation you may use file in server folder (.htaccess and generator script), or another methods.