PHP code example of emnabs / yii2-jcrop

1. Go to this page and download the library: Download emnabs/yii2-jcrop library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

emnabs / yii2-jcrop example snippets


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

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

php composer