PHP code example of macgyer / yii2-cropit
1. Go to this page and download the library: Download macgyer/yii2-cropit 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/ */
macgyer / yii2-cropit example snippets
// 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())