platx/yii2-uploads-action

This package is abandoned and no longer maintained. No replacement package was suggested.

For individual use.

Installs: 1 238

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:yii2-extension

dev-master 2015-12-17 10:58 UTC

This package is not auto-updated.

Last update: 2017-11-24 14:08:10 UTC


README

For individual use.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist platx/yii2-uploads-action "*"

or add

"platx/yii2-uploads-action": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, add this action to your controller :

public function actions()
{
    return [
        'uploads' => [
            'class' => 'platx\uploads\UploadsAction',
        ],
        ...
    ];
}

In your url rules add following rules:

'uploads/<width:\d+>x<height:\d+>/<model:[\w_]+>/<field:[\w-]+>/<dp:[\d\/]+>/<file:[\w-]+>.<ext:\w+>' => '{your_controller}/uploads',
'uploads/original/<model:[\w_]+>/<field:[\w-]+>/<dp:[\d\/]+>/<file:[\w-]+>.<ext:\w+>' => '{your_controller}/uploads',

Nginx config:

location ~* /uploads/(\d+)/(\d+) {
    index index.php;
    try_files $uri $uri/ /index.php?$args;
}