2017 © Pedro Peláez
 

yii2-extension yii2-cropperimageupload

Crop image upload for Yii framework.

image

ereminmdev/yii2-cropperimageupload

Crop image upload for Yii framework.

  • Thursday, July 5, 2018
  • by ereminmdev
  • Repository
  • 0 Watchers
  • 0 Stars
  • 102 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 18 Versions
  • 32 % Grown

The README.md

yii2-cropperimageupload

Crop image upload for Yii framework., (*1)

This widget depend on: - https://github.com/mohorev/yii2-upload-behavior - https://github.com/fengyuanchen/cropperjs, (*2)

Install

composer require ereminmdev/yii-cropperimageupload, (*3)

Use

public function behaviors()
{
    return [
        ...
        'avatar' => [
            'class' => CropperImageUploadBehavior::class,
            'attribute' => 'avatar',
            'scenarios' => ['create', 'update'],
            'placeholder' => '@app/modules/user/assets/images/avatar.jpg',
            'path' => '@webroot/upload/avatar/{id}',
            'url' => '@web/upload/avatar/{id}',
            'thumbs' => [
                'thumb' => ['width' => 42, 'height' => 42, 'mode' => ManipulatorInterface::THUMBNAIL_OUTBOUND],
                'preview' => ['width' => 200, 'height' => 200, 'mode' => ManipulatorInterface::THUMBNAIL_OUTBOUND],
            ],
            'cropAspectRatio' => 1,
        ],
    ];
}

View file:, (*4)

<?php $form = ActiveForm::begin(); ?>
    <?= $form->field($model, 'photo')->widget(CropperImageUploadWidget::class) ?>
    <div class="form-group">
        <?= Html::submitButton('Submit', ['class' => 'btn btn-primary']) ?>
    </div>
<?php ActiveForm::end(); ?>

Tips

If need for re-create thumbs, add to console/controller:, (*5)

foreach (Product::find()->each() as $model) {
    $file_name = $model->getAttribute('image');

    if ($model->recreateThumbs('image', true, true)) {
        $this->stdout('Recreated successful: ' . $file_name . PHP_EOL);
    } else {
        $this->stdout('Error when recreating: ' . $file_name . PHP_EOL, Console::FG_RED);
    }
}

The Versions

05/07 2018

dev-master

9999999-dev https://bitbucket.org/ereminmdev/yii2-cropperimageupload

Crop image upload for Yii framework.

  Sources   Download

MIT

The Requires

 

by Michael Eremin

yii2 behavior crop image upload

05/07 2018

v1.0.16

1.0.16.0 https://bitbucket.org/ereminmdev/yii2-cropperimageupload

Crop image upload for Yii framework.

  Sources   Download

MIT

The Requires

 

by Michael Eremin

yii2 behavior crop image upload

27/06 2018

v1.0.15

1.0.15.0 https://bitbucket.org/ereminmdev/yii2-cropperimageupload

Crop image upload for Yii framework.

  Sources   Download

MIT

The Requires

 

by Michael Eremin

yii2 behavior crop image upload

24/06 2018

v1.0.14

1.0.14.0 https://bitbucket.org/ereminmdev/yii2-cropperimageupload

Crop image upload for Yii framework.

  Sources   Download

MIT

The Requires

 

by Michael Eremin

yii2 behavior crop image upload

24/06 2018

v1.0.13

1.0.13.0 https://bitbucket.org/ereminmdev/yii2-cropperimageupload

Crop image upload for Yii framework.

  Sources   Download

MIT

The Requires

 

by Michael Eremin

yii2 behavior crop image upload

07/05 2018

v1.0.12

1.0.12.0 https://bitbucket.org/ereminmdev/yii2-cropperimageupload

Crop image upload for Yii framework.

  Sources   Download

MIT

The Requires

 

by Michael Eremin

yii2 behavior crop image upload

05/05 2018

v1.0.11

1.0.11.0 https://bitbucket.org/ereminmdev/yii2-cropperimageupload

Crop image upload for Yii framework.

  Sources   Download

MIT

The Requires

 

by Michael Eremin

yii2 behavior crop image upload

28/04 2018

v1.0.10

1.0.10.0 https://bitbucket.org/ereminmdev/yii2-cropperimageupload

Crop image upload for Yii framework.

  Sources   Download

MIT

The Requires

 

by Michael Eremin

yii2 behavior crop image upload

27/04 2018

v1.0.9

1.0.9.0 https://bitbucket.org/ereminmdev/yii2-cropperimageupload

Crop image upload for Yii framework.

  Sources   Download

MIT

The Requires

 

by Michael Eremin

yii2 behavior crop image upload

26/04 2018

v1.0.8

1.0.8.0 https://bitbucket.org/ereminmdev/yii2-cropperimageupload

Crop image upload for Yii framework.

  Sources   Download

MIT

The Requires

 

by Michael Eremin

yii2 behavior crop image upload

19/02 2018

v1.0.7

1.0.7.0 https://bitbucket.org/ereminmdev/yii2-cropperimageupload

Crop image upload for Yii framework.

  Sources   Download

MIT

The Requires

 

by Michael Eremin

yii2 behavior crop image upload

07/02 2018

v1.0.6

1.0.6.0 https://bitbucket.org/ereminmdev/yii2-cropperimageupload

Crop image upload for Yii framework.

  Sources   Download

MIT

The Requires

 

by Michael Eremin

yii2 behavior crop image upload

12/09 2017

v1.0.5

1.0.5.0 https://bitbucket.org/ereminmdev/yii2-cropperimageupload

Crop image upload for Yii framework.

  Sources   Download

MIT

The Requires

 

by Michael Eremin

yii2 behavior crop image upload

12/09 2017

v1.0.4

1.0.4.0 https://bitbucket.org/ereminmdev/yii2-cropperimageupload

Crop image upload for Yii framework.

  Sources   Download

MIT

The Requires

 

by Michael Eremin

yii2 behavior crop image upload

11/09 2017

v1.0.3

1.0.3.0 https://bitbucket.org/ereminmdev/yii2-cropperimageupload

Crop image upload for Yii framework.

  Sources   Download

MIT

The Requires

 

by Michael Eremin

yii2 behavior crop image upload

11/09 2017

v1.0.2

1.0.2.0 https://bitbucket.org/ereminmdev/yii2-cropperimageupload

Crop image upload for Yii framework.

  Sources   Download

MIT

The Requires

 

by Michael Eremin

yii2 behavior crop image upload

11/09 2017

v1.0.1

1.0.1.0 https://bitbucket.org/ereminmdev/yii2-cropperimageupload

Crop image upload for Yii framework.

  Sources   Download

MIT

The Requires

 

by Michael Eremin

yii2 behavior crop image upload

09/09 2017

v1.0.0

1.0.0.0 https://bitbucket.org/ereminmdev/yii2-cropperimageupload

Crop image upload for Yii framework.

  Sources   Download

MIT

The Requires

 

by Michael Eremin

yii2 behavior crop image upload