PHPackages                             mackrais/yii2-crop-image-section - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mackrais/yii2-crop-image-section

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

mackrais/yii2-crop-image-section
================================

Cropping widget yii2 by section. The widget supports transparent background png,gif

1.0(8y ago)78.7k↓25%4BSD 3-ClausePHPPHP &gt;=5.3.0

Since Sep 16Pushed 8y ago2 watchersCompare

[ Source](https://github.com/mackrais/yii2-crop-image-section)[ Packagist](https://packagist.org/packages/mackrais/yii2-crop-image-section)[ Docs](https://github.com/mackrais/yii2-crop-image-section)[ RSS](/packages/mackrais-yii2-crop-image-section/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

yii2-crop-image-section
=======================

[](#yii2-crop-image-section)

[![Latest Stable Version](https://camo.githubusercontent.com/0bd5eb9b623f7c505e2369ca30ed596938d1be9f35a5930679634d48daf880c1/68747470733a2f2f706f7365722e707567782e6f72672f6d61636b726169732f796969322d63726f702d696d6167652d73656374696f6e2f762f737461626c65)](https://packagist.org/packages/mackrais/yii2-crop-image-section)[![Latest Unstable Version](https://camo.githubusercontent.com/c40e3ff8d17736055c09172f6fe2095ad6fd4dc26c013f7d7512e1770630fcaf/68747470733a2f2f706f7365722e707567782e6f72672f6d61636b726169732f796969322d63726f702d696d6167652d73656374696f6e2f762f756e737461626c65)](https://packagist.org/packages/mackrais/yii2-crop-image-section)[![License](https://camo.githubusercontent.com/f1eca8471a0f23a766e812e22348b52f4cfc1838fde98050c1e9181f346d20ff/68747470733a2f2f706f7365722e707567782e6f72672f6d61636b726169732f796969322d63726f702d696d6167652d73656374696f6e2f6c6963656e7365)](https://packagist.org/packages/mackrais/yii2-crop-image-section)[![Total Downloads](https://camo.githubusercontent.com/b3977056fdea75c35fc7f2a63528cf2354eb54ca484242e8f4ef6b81a7e0a158/68747470733a2f2f706f7365722e707567782e6f72672f6d61636b726169732f796969322d63726f702d696d6167652d73656374696f6e2f646f776e6c6f616473)](https://packagist.org/packages/mackrais/yii2-crop-image-section)[![Monthly Downloads](https://camo.githubusercontent.com/a738fa79916cc6574de846fac27b3d2e6bfacb7d68ee7bf4fbe03ed7bbc57bd3/68747470733a2f2f706f7365722e707567782e6f72672f6d61636b726169732f796969322d63726f702d696d6167652d73656374696f6e2f642f6d6f6e74686c79)](https://packagist.org/packages/mackrais/yii2-crop-image-section)[![Daily Downloads](https://camo.githubusercontent.com/38e6ec3ced0eb4459f4c860d22058f9e99fe62f5f5031f1491e96b34f45e9a25/68747470733a2f2f706f7365722e707567782e6f72672f6d61636b726169732f796969322d63726f702d696d6167652d73656374696f6e2f642f6461696c79)](https://packagist.org/packages/mackrais/yii2-crop-image-section)

This widget is based on the [ Guillotine jQuery plugin](http://guillotine.js.org/) plugin.

[![SectionCrop Screenshot](https://camo.githubusercontent.com/e6bc338b3bdb70b75a2f56d06acea9a5e114e27ab3526767390496cbb084607c/68747470733a2f2f617263686976652e6f72672f646f776e6c6f61642f53637265656e73686f7446726f6d32303135313133303130303232302f53637265656e73686f7425323066726f6d253230323031352d31312d333025323031303a30323a32302e706e67)](https://camo.githubusercontent.com/e6bc338b3bdb70b75a2f56d06acea9a5e114e27ab3526767390496cbb084607c/68747470733a2f2f617263686976652e6f72672f646f776e6c6f61642f53637265656e73686f7446726f6d32303135313133303130303232302f53637265656e73686f7425323066726f6d253230323031352d31312d333025323031303a30323a32302e706e67)

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist mackrais/yii2-crop-image-section "dev-master"

```

or

```
"mackrais/yii2-crop-image-section": "dev-master"

```

or add

```
 composer require mackrais/yii2-crop-image-section:"dev-master"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

```
use mackrais\cropimage\ImageCropSection;

// usage by model
echo 'Cropping section';
echo  $form->field($model, "image")->widget(mackrais\cropimage\ImageCropSection::className(), [
                         'options' => [
                             'id' => 'mr_file_input1',
                             'class' => 'hidden',
                         ],
                         'attribute_x'=>'section1_x',
                         'attribute_y'=>'section1_y',
                         'attribute_width'=>'section1_w',
                         'attribute_height'=>'section1_h',
                         'attribute_scale'=>'section1_scale',
                         'attribute_remove'=>'section1_remove',
                         'class_block'=>'center-block',
                         'plugin_options' => [
                             'width' => 400,
                             'height' => 400,
                             'id_input_file' => 'mr_file_input1',
                             'section' => 'section_1'
                         ],

                         'template_image'=> null

                  ])->label(false);
```

Example use
-----------

[](#example-use)

For example we have Unit category with image.

UnitCategory.php
----------------

[](#unitcategoryphp)

```
