emnabs/yii2-jcrop

yii2 image cropping extension

Installs: 1 193

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Language:JavaScript

Type:yii2-extension

v1.0.3 2019-03-29 05:23 UTC

This package is auto-updated.

Last update: 2024-11-29 05:38:43 UTC


README

Yii2 image cropping extension

Installation

The preferred way to install this extension is through composer.

Either run

php composer require --prefer-dist emnabs/yii2-jcrop "*"

or add

"emnabs/yii2-jcrop": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

use emnabs\jcrop\Jcrop;
<?= $form->field($model, 'avatar')->widget(Jcrop::className(), [
    'uploadUrl' => Url::toRoute('/user/avatar'),
])->label(false) ?>

Widget has following properties:

In UserController:

    public function actions()
    {
        return [
            'avatar' => [
                'class' => 'emnabs\jcrop\actions\Upload',
                'url' => '/common/files/',
                'path' => Yii::getAlias('@files'),
                'name' => Yii::$app->user->id
            ]
        ];
    }

Action has following parameters:

Operates as follows:

screenshot screenshot

License

yii2-jcrop is an open source project modified by Ehsan Rezaei(http://www.developit.ir) that is licensed under GPL-3.0. used and modified from https://github.com/rezaei121/yii2-jcrop