macgyer / yii2-cropit
Yii2 implementation of cropit
Installs: 1 557
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- php: >=5.4.0
- bower-asset/cropit: 0.5.1
- macgyer/yii2-data-uri-validator: *
- yiisoft/yii2: >=2.0.4
This package is auto-updated.
Last update: 2024-12-10 08:12:10 UTC
README
yii2-cropit
Implementation of Scott Cheng's jQuery plugin cropit.
Currently implemented cropit.js version: 0.5.1
Installation
The preferred way of installation is through Composer. If you don't have Composer you can get it here: https://getcomposer.org/
To install the package add the following to the require
section of your composer.json:
"require": {
"macgyer/yii2-cropit": "*"
},
Usage
This widget can be used in ActiveForm or as standalone input widget and comes with a Data URI validator (as Composer dependency).
The widget can be profoundly configured to meet your needs. Please see all options and below and refer to the original cropit documentation.
To use the widget in your form, you might do the following:
// add the field to your Model class, either ActiveRecord property or class member:
public $cropped_image_data;
// rules
public function rules()
{
return [
// more rules
['cropped_image_data', \macgyer\yii2dataurivalidator\DataUriValidator::className()],
];
}
// in your View, define the field and widget:
<?= $form->field($model, 'cropped_image_data')->widget(\macgyer\yii2cropit\widgets\CropitWidget::className()) ?>
Road map
- create style assets
Change log
1.0.3 - 2017-07-29
- fixed illegal offset type error when used in PHP 5.6 environment (#3)
- cropit.js version set to 0.5.1
1.0.2 - 2016-06-02
1.0.1 - 2016-05-30
1.0.0 - 2016-05-29
- initial release