IMage Crop
Crop image with croppic.js lib, (*1)
Installation
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require --prefer-dist shoxabbos/yii2-imagecrop "*"
or add, (*4)
"shoxabbos/yii2-imagecrop": "*"
to the require section of your composer.json
file., (*5)
Demo
, (*6)
Usage
Add this action to your controller, (*7)
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, (*8)
\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, (*9)