dominus77/yii2-jcrop-widget

Jcrop Image Cropping Plugin for Yii2.

Maintainers

👁 dominus77

Package info

github.com/Dominus77/yii2-jcrop-widget

Type:yii2-extension

pkg:composer/dominus77/yii2-jcrop-widget

Statistics

Installs: 5 638

Dependents: 1

Suggesters: 0

Stars: 1

Open Issues: 0

v2.1.2 2020-02-17 07:37 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 7ef130838e59c5e96aae78b9c19d3186152cedc3

  • Alexey Schevchenko <ivanovosity.woop@gmail.com>

extensionwidgetyii2jcropDominus77

This package is auto-updated.

Last update: 2026-06-17 23:48:54 UTC


README

👁 Latest Version
👁 Software License
👁 Build Status
👁 codecov
👁 Scrutinizer Code Quality
👁 Total Downloads

Jcrop - Image Cropping for jQuery

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require dominus77/yii2-jcrop-widget

or add

"dominus77/yii2-jcrop-widget": "^2.1"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by mimimum run:

<?= \dominus77\jcrop\JCrop::widget([
 'image' => Yii::getAlias('@web/uploads/image1.jpg') // url to your image 
]) ?>

Set Options:

<?= \dominus77\jcrop\JCrop::widget([
 'image' => Yii::getAlias('@web/uploads/image1.jpg'),
 'pluginOptions' => [
 'minSize' => [50, 37],
 'maxSize' => [500, 370],
 'setSelect' => [10, 10, 40, 40],
 'bgColor' => 'black',
 'bgOpacity' => 0.5,
 'onSelect' => new yii\web\JsExpression("function(c){console.log(c.x);}"),
 'onChange' => new yii\web\JsExpression("function(c){console.log(c.x);}")
 ]
]) ?>

CallBack:

<?= \dominus77\jcrop\JCrop::widget([
 'image' => Yii::getAlias('@web/uploads/image1.jpg'),
 'pluginOptions' => [//...],
 'callBack' => new yii\web\JsExpression("
 function(){
 jcrop_api = this;
 }
 ")
]) ?>

More Information

Please, check the Manual

Testing

$ vendor/bin/phpunit

License

The MIT License (MIT). Please see License File for more information.