PHPackages                             germanoricardi/yii2-imagecrop - 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. [Image &amp; Media](/categories/media)
4. /
5. germanoricardi/yii2-imagecrop

ActiveYii2-extension[Image &amp; Media](/categories/media)

germanoricardi/yii2-imagecrop
=============================

PHP class to crop images with yii2

1.0.1(10y ago)044MITPHPPHP &gt;=5.6

Since Apr 22Pushed 10y ago1 watchersCompare

[ Source](https://github.com/germanoricardi/yii2-imagecrop)[ Packagist](https://packagist.org/packages/germanoricardi/yii2-imagecrop)[ Docs](https://github.com/germanoricardi/yii2-imagecrop)[ RSS](/packages/germanoricardi-yii2-imagecrop/feed)WikiDiscussions master Synced 4w ago

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

[![Latest Stable Version](https://camo.githubusercontent.com/30a4c05121bce73e96db287c25f74c33ef55338e8a3c814448be05e72c5e36d5/68747470733a2f2f706f7365722e707567782e6f72672f6765726d616e6f726963617264692f796969322d696d61676563726f702f762f737461626c65)](https://packagist.org/packages/germanoricardi/yii2-imagecrop) [![Total Downloads](https://camo.githubusercontent.com/33b8750866b383bf990bcfcd7990cbccc22c9285277d120171c6ec13905bfd26/68747470733a2f2f706f7365722e707567782e6f72672f6765726d616e6f726963617264692f796969322d696d61676563726f702f646f776e6c6f616473)](https://packagist.org/packages/germanoricardi/yii2-imagecrop) [![Latest Unstable Version](https://camo.githubusercontent.com/e37e971267354784be60ec13ccf49301978ee7b3960bacdafe25c68967cd24d8/68747470733a2f2f706f7365722e707567782e6f72672f6765726d616e6f726963617264692f796969322d696d61676563726f702f762f756e737461626c65)](https://packagist.org/packages/germanoricardi/yii2-imagecrop) [![License](https://camo.githubusercontent.com/78844a8f014e0341e1cf27c401ca890833a13a6b4e1afa83abf1f53a104ed2c2/68747470733a2f2f706f7365722e707567782e6f72672f6765726d616e6f726963617264692f796969322d696d61676563726f702f6c6963656e7365)](https://packagist.org/packages/germanoricardi/yii2-imagecrop)

yii2-imagecrop
==============

[](#yii2-imagecrop)

Crop images with this class is **very simple**!

Resources
---------

[](#resources)

- Centralized autocrop;
- Customized cutting area with json;
- Watermark;

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

[](#installation)

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

### Install

[](#install)

Either run

```
$ php composer.phar require germanoricardi/yii2-imagecrop "*"

```

or add

```
"germanoricardi/yii2-imagecrop": "*"

```

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

*\*\*Part of this class code was implemented by a [document](https://github.com/fengyuanchen/cropper/tree/master/examples/crop-avatar) made available by [fengyuanchen](https://github.com/fengyuanchen)*.

How to use
----------

[](#how-to-use)

Add the following code in a controller, **the image that will be used for cutting should already be on your server**, that is, the code should be run after the file upload. **The original image is always preserved**.

```
use germanoricardi\imagecrop\ImageCrop;

public function actionCrop(){
    $imageCrop = new ImageCrop();
    $imageCrop->imageSourcePath	= '@webroot/medias/';
    $imageCrop->imagesSizes		= [
        ['path' => '@webroot/medias/thumbs/', 'width' => '200', 'height' => '200'],
        ['path' => '@webroot/medias/large/', 'width' => '800', 'height' => '600', 'watermark' => '@webroot/watermark.png']
    ];
    $imageCrop->imageFileName	= 'image-to-crop.jpg';
    $imageCrop->init();
}

```

AJAX
----

[](#ajax)

If you are working with a jQuery plugin for crop image parameters can be passed to the class via **AJAX** as follows:

```
    $imageCrop = new ImageCrop();
    $imageCrop->imageSourcePath	= '@webroot/medias/';
    $imageCrop->imagesSizes		= [
        ['path' => '@webroot/medias/thumbs/', 'width' => '200', 'height' => '200'],
        ['path' => '@webroot/medias/large/', 'width' => '800', 'height' => '600', 'watermark' => '@webroot/watermark.png']
    ];
    $imageCrop->imageFileName	= 'image-to-crop.jpg';

    // AJAX
    $imageCrop->data            = '{"x":220,"y":26,"width":1168,"height":1168,"rotate":0,"scaleX":1,"scaleY":1}';

    $imageCrop->init();

```

License
-------

[](#license)

[![License](https://camo.githubusercontent.com/78844a8f014e0341e1cf27c401ca890833a13a6b4e1afa83abf1f53a104ed2c2/68747470733a2f2f706f7365722e707567782e6f72672f6765726d616e6f726963617264692f796969322d696d61676563726f702f6c6963656e7365)](https://packagist.org/packages/germanoricardi/yii2-imagecrop)

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~24 days

Total

2

Last Release

3697d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2c90c5f85cdf5fffa8aa1e6cb8f8d0446a6e6ad2ef07aabfdce5dec34b2f3b0f?d=identicon)[germanoricardi](/maintainers/germanoricardi)

---

Top Contributors

[![germanoricardi](https://avatars.githubusercontent.com/u/116641?v=4)](https://github.com/germanoricardi "germanoricardi (10 commits)")

---

Tags

cropyii2 cropyii2 image cropcrop class

### Embed Badge

![Health badge](/badges/germanoricardi-yii2-imagecrop/health.svg)

```
[![Health](https://phpackages.com/badges/germanoricardi-yii2-imagecrop/health.svg)](https://phpackages.com/packages/germanoricardi-yii2-imagecrop)
```

###  Alternatives

[sybio/image-workshop

Powerful PHP class using GD library to work easily with images including layer notion (like Photoshop or GIMP)

854936.5k12](/packages/sybio-image-workshop)[jonom/focuspoint

Smarter automatic image cropping for Silverstripe

107663.8k55](/packages/jonom-focuspoint)[ctessier/nova-advanced-image-field

An advanced image field for Nova with cropping and resizing.

102563.4k1](/packages/ctessier-nova-advanced-image-field)[jbzoo/image

A PHP class that simplifies working with images

171128.5k3](/packages/jbzoo-image)[stefangabos/zebra_image

A single-file, lightweight PHP library designed for efficient image manipulation featuring methods for modifying images and applying filters

138115.5k7](/packages/stefangabos-zebra-image)[raoul2000/yii2-jcrop-widget

This extension is a wrapper for the jQuery Image Cropping Plugin (jcrop)

10262.8k2](/packages/raoul2000-yii2-jcrop-widget)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
