PHP code example of ereminmdev / yii2-croppieimageupload

1. Go to this page and download the library: Download ereminmdev/yii2-croppieimageupload 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/ */

    

ereminmdev / yii2-croppieimageupload example snippets


 $form = ActiveForm::begin(); 

public function behaviors()
{
    return [
        ...
        'avatar' => [
            'class' => CroppieImageUploadBehavior::class,
            'attribute' => 'avatar',
            'scenarios' => ['create', 'update'],
            'placeholder' => '@app/modules/user/assets/images/avatar.jpg',
            'path' => '@webroot/upload/avatar/{id}',
            'url' => '@web/upload/avatar/{id}',
            'thumbs' => [
                'thumb' => ['width' => 42, 'height' => 42, 'mode' => ManipulatorInterface::THUMBNAIL_OUTBOUND],
                'preview' => ['width' => 200, 'height' => 200, 'mode' => ManipulatorInterface::THUMBNAIL_OUTBOUND],
            ],
            'ratio' => 1,
        ],
    ];
}