zoge/yii2-jcrop

yii2 image cropping extension

Maintainers

Details

github.com/zoge/yii2-jcrop

Source

Installs: 8

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Type:yii2-extension

1.2.2 2020-01-25 10:07 UTC

This package is auto-updated.

Last update: 2024-09-26 05:43:12 UTC


README

yii2 image cropping extension

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist zoge/yii2-jcrop "*"

or add

"zoge/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 zoge\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' => 'zoge\jcrop\actions\Upload',
                'url' => '/common/files/',
                'path' => Yii::getAlias('@files'),
                'name' => Yii::$app->user->id
            ]
        ];
    }

Action has following parameters:

Operates as follows:

screenshot

License

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