shoxabbos/yii2-imagecrop

Simple photo cropper

Installs: 576

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Language:JavaScript

Type:yii2-extension

v2.0.0 2017-08-17 07:09 UTC

This package is not auto-updated.

Last update: 2024-04-27 23:37:17 UTC


README

Crop image with croppic.js lib

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist shoxabbos/yii2-imagecrop "*"

or add

"shoxabbos/yii2-imagecrop": "*"

to the require section of your composer.json file.

Demo

alt text

Usage

Add this action to your controller

public function actions()
{
    return [
        'crop' => [
            'class' => \shoxabbos\imagecrop\CropAction::className(),
            'width' => 900,
            'height' => 600,
            'whenCropped' => function () {
                // when file cropped!
            }
        ]
    ];
}

Add this code to your view file

\shoxabbos\imagecrop\CropWidget::widget([
    'action' => Url::to(['crop']),
    'image' => $model->photoUrl,
    'path' => Yii::getAlias('@webroot')."/".$model->photo,
    'ration' => '4 / 3',
]);

Developer Team http://www.qwerty.uz