2017 © Pedro Peláez
 

yii2-extension yii2-image-cropper

yii2 image cropper

image

alvinojutsu/yii2-image-cropper

yii2 image cropper

  • Thursday, May 11, 2017
  • by alvinux
  • Repository
  • 2 Watchers
  • 0 Stars
  • 973 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 78 % Grown

The README.md

yii2 image cropper

yii2 image cropper, (*1)

this repo is modification from https://github.com/navatech/yii2-cropper, (*2)

thanks to @lephuong, (*3)

Enhancement

  • Crop 1 image multiple size
  • Thumbnail default size

Installation

The preferred way to install this extension is through composer., (*4)

Either run, (*5)

php composer.phar require --prefer-dist alvinojutsu/yii2-image-cropper "*"

or add, (*6)

"alvinojutsu/yii2-image-cropper": "*"

to the require section of your composer.json file., (*7)

Usage

Once the extension is installed, simply use it in your code by :, (*8)

Without $model, (*9)

<?= \alvinux\imagecropper\Cropper::widget([
    'name' => 'Post[picture]',
    // 'value' => 'https://fengyuanchen.github.io/cropper/images/picture.jpg', // Default blank image if not sett
    'options' => [
        ['width' => 200,'height' => 200],
        ['width' => 500,'height' => 200],
        ['width' => 500,'height' => 100],
    ],
    'showThumbnailCropper' => true, // optional, if ( showThumbnailCropper == false && autoCrop == true ) then 'hidden' else 'show',
    'autoCrop' => true, // optional, default (true), if autoCrop = 'true' there is no "Crop Image" button, if set false then you have to click 'Crop Image' button to get value
    'thumbnail' => ['width' => 250, 'height' => 250], // optional, default 150 x 150
    'pluginOptions' => [
        // https://github.com/fengyuanchen/cropper
        // Options default
        // 'autoCropArea'   => true,
        // 'strict'   => false,
        // 'guides'   => true,
        // 'highlight'   => true,
    ]
]); ?>

With $model, (*10)

<?= \alvinux\imagecropper\Cropper::widget([
    'model' => $model,
    'attribute' => 'picture',
    'options' => [
        ['width' => 200,'height' => 200],
        ['width' => 500,'height' => 200],
        ['width' => 500,'height' => 100],
    ],
    'showThumbnailCropper' => true, // optional, if ( showThumbnailCropper == false && autoCrop == true ) then 'hidden' else 'show',
    'autoCrop' => true, // optional, default (true), if autoCrop = 'true' there is no "Crop Image" button, if set false then you have to click 'Crop Image' button to get value
    'thumbnail' => ['width' => 250, 'height' => 250], // optional, default 150 x 150
    'pluginOptions' => [
        //https://github.com/fengyuanchen/cropper
    ]
]); ?>

Screenshot

  • Default without image br/ without image

  • With image br/ with image

The Versions

11/05 2017

dev-dev

dev-dev

yii2 image cropper

  Sources   Download

MIT

The Requires

 

by Avatar alvinux

extension yii2 image cropper

11/05 2017

dev-master

9999999-dev

yii2 image cropper

  Sources   Download

MIT

The Requires

 

by Avatar alvinux

extension yii2 image cropper