PHPackages                             it-blaster/crop-bundle - 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. it-blaster/crop-bundle

ActiveLibrary[Image &amp; Media](/categories/media)

it-blaster/crop-bundle
======================

The bundle for in-form image cropping

v1.1.0(9y ago)08.1k↓78.6%MITPHPPHP &gt;=5.3.2

Since Apr 28Pushed 9y ago7 watchersCompare

[ Source](https://github.com/it-blaster/crop-bundle)[ Packagist](https://packagist.org/packages/it-blaster/crop-bundle)[ Docs](https://github.com/it-blaster/crop-bundle)[ RSS](/packages/it-blaster-crop-bundle/feed)WikiDiscussions master Synced yesterday

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

CropBundle
==========

[](#cropbundle)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/2825afd208506ab70df8673f512ff5ba3822330c759628ca8bf02e5e22d3284b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f69742d626c61737465722f63726f702d62756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/it-blaster/crop-bundle/?branch=master)[![Build Status](https://camo.githubusercontent.com/e471cb1bb465593f42c8f33d54a3105afe5b4a95165871a4aea43481cb7bab9b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f69742d626c61737465722f63726f702d62756e646c652f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/it-blaster/crop-bundle/build-status/master)[![License](https://camo.githubusercontent.com/2c347bf16f46ea915e564fc8a1ea83fab126786a33c732a146883ef10b82f3a5/68747470733a2f2f706f7365722e707567782e6f72672f69742d626c61737465722f63726f702d62756e646c652f6c6963656e73652e737667)](https://packagist.org/packages/it-blaster/crop-bundle)[![Total Downloads](https://camo.githubusercontent.com/d8f02890b74d701793eb4a3554af05560b2a71aa30bc06c2c21d9ce358017184/68747470733a2f2f706f7365722e707567782e6f72672f69742d626c61737465722f63726f702d62756e646c652f646f776e6c6f616473)](https://packagist.org/packages/it-blaster/crop-bundle)[![Latest Unstable Version](https://camo.githubusercontent.com/f825c96749d63c74267b565fa6ecffeec63ed196a6dbdcb521d68953ffb0bcbe/68747470733a2f2f706f7365722e707567782e6f72672f69742d626c61737465722f63726f702d62756e646c652f762f756e737461626c652e737667)](https://packagist.org/packages/it-blaster/crop-bundle)[![Latest Stable Version](https://camo.githubusercontent.com/64376fb1eb4da999b4fe3d31b50a66c62dd5742c1c738c062e2d6f0cde7f4f20/68747470733a2f2f706f7365722e707567782e6f72672f69742d626c61737465722f63726f702d62756e646c652f762f737461626c652e737667)](https://packagist.org/packages/it-blaster/crop-bundle)

This bundle is designed to create crops for images using the user-friendly UI in your forms. It uses the [fengyuanchen/cropper](https://github.com/fengyuanchen/cropper) jquery plugin and [it-blaster/uploadable-bundle](https://github.com/it-blaster/uploadable-bundle) to handle images uploading.

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

[](#installation)

Add it-blaster/crop-bundle to your `composer.json` file and run `composer`

```
...
"require": {
    "it-blaster/crop-bundle": "1.0.*"
}
...
```

Register the bundle in your `AppKernel.php`

```
...
new Fenrizbes\CropBundle\FenrizbesCropBundle(),
...
```

Configure [it-blaster/uploadable-bundle](https://github.com/it-blaster/uploadable-bundle)

Usage
-----

[](#usage)

**1.** Configure the `CroppableBehavior` for your table in `schema.xml`:

```
...

...
```

The parameter `columns` must contain one or more columns' names on which you want to apply this behavior (default value: `image`). If your table contains other file-columns and you use the `UploadableBundle` to handle them, don't worry: this bundle automatically adds its columns into `UploadableBehavior` configuration.

The `CroppableBehavior` creates two methods for each configured column: `setCroppable` and `getCroppable`. (For example, if you configured the behavior as above, in your base model will be created following methods: `setCroppableFirstImage`, `getCroppableFirstImage`, `setCroppableSecondImage` and `getCroppableSecondImage`). You have to use this methods if you want to set up the `croppable` FormType or get a cropped image.

**2.** Include bundle's resources in your page:

- `bundles/fenrizbescrop/lib/js/cropper.min.js` - the cropper plugin
- `bundles/fenrizbescrop/lib/css/cropper.min.css` - cropper's styles
- `bundles/fenrizbescrop/js/croppable.js` - bundle's scripts

Also remember that this bundle doesn't contain the `JQuery` library that's required for the cropper plugin.

**3.** Configure your form:

```
...
    ->add('CroppableFirstImage', 'croppable', array(
        'width'  => 250,
        'height' => 250
    ))
...
```

This construction adds a crop control for a picture in your form. Required parameters `width` and `height` set up the minimum size of the crop area. You can read more about the `croppable` FormType's configuration in the relevant section.

After you upload an image, you'll see it with the crop area over it. Now you can select a part of the image and save crop coordinates.

**4.** The bundle contains a twig filter `crop` that provide you an ability to get a cropped image:

```
...

...
```

If you configured a few crops for one picture, you can pass an index of the crop you want:

```
...

...
```

CroppableFormType configuration
-------------------------------

[](#croppableformtype-configuration)

The full set of specific parameters that you can pass to `croppable` field looks as follows:

```
...
    ->add('CroppableSecondImage', 'croppable', array(
        'label'             => 'Image crops',
        'width'             => 250,
        'height'            => 250,
        'validate'          => false,
        'max_canvas_width'  => 600,
        'max_canvas_height' => 600,
        'instances'         => array(
            array(
                'label'  => 'First crop',
                'width'  => 200,
                'height' => 250
            ),
            array(
                'label'  => 'Second crop',
                'width'  => 100,
                'height' => 100
            )
        )
    ))
...
```

#### `label`

[](#label)

It's not a specific parameter but you need to know that this label display before all the field's controls.

#### `width` and `height`

[](#width-and-height)

Determine the default minimum size of the crop area. You can't select a part of image less than minimum.

#### `validate`

[](#validate)

This parameter enables or disables validation for the image file. Validation constraints include a check of the mime-type (only `gif`, `png` and `jpg` formats are allowed) and a check of minimum picture's size (the image can't be less than the biggest of its crops). Default value: `true`.

#### `max_canvas_width` and `max_canvas_height`

[](#max_canvas_width-and-max_canvas_height)

These two values determine the max size of canvas in which will be inserted the original image and the crop control. The original image will be scaled proportionally. If you want to disable this limitation, set `0` or `false`to this options. Default values: `640` and `480` pixels.

#### `instances`

[](#instances)

`instances` is a very important option. By default there is only one crop for each image. But if you want to do more different crops for one image, you can configure them in this option. It must be an array of array. Each of them describes one crop instance and takes three optional parameters:

- `label` - the label for this crop (default `null`)
- `width` adn `height` - the minimum size of the crop area for this crop (by default they inherit values from the base `width` adn `height`)

TODO
----

[](#todo)

- Delete previously generated and currently unused crops

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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 ~243 days

Total

3

Last Release

3598d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11211873?v=4)[Iaroslav Gashuk](/maintainers/fenrizbes)[@fenrizbes](https://github.com/fenrizbes)

---

Top Contributors

[![kugart](https://avatars.githubusercontent.com/u/14324571?v=4)](https://github.com/kugart "kugart (1 commits)")

---

Tags

symfonyimageformcroppropel

### Embed Badge

![Health badge](/badges/it-blaster-crop-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/it-blaster-crop-bundle/health.svg)](https://phpackages.com/packages/it-blaster-crop-bundle)
```

###  Alternatives

[liip/imagine-bundle

This bundle provides an image manipulation abstraction toolkit for Symfony-based projects.

1.7k40.0M247](/packages/liip-imagine-bundle)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1189.8k](/packages/rcsofttech-audit-trail-bundle)[gregwar/image-bundle

Image handling bundle

1981.5M9](/packages/gregwar-image-bundle)[ahmed-bhs/doctrine-doctor

Runtime analysis tool for Doctrine ORM integrated into Symfony Web Profiler. Unlike static linters, it analyzes actual query execution at runtime to detect performance bottlenecks, security vulnerabilities, and best practice violations during development with real execution context and data.

9410.8k](/packages/ahmed-bhs-doctrine-doctor)[intervention/image-symfony

Symfony Integration of Intervention Image

1097.0k](/packages/intervention-image-symfony)[ecotone/symfony-bundle

Ecotone for Symfony — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Symfony Messenger, via PHP attributes.

11249.0k1](/packages/ecotone-symfony-bundle)

PHPackages © 2026

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