PHPackages                             fulgurio/image-handler-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. fulgurio/image-handler-bundle

AbandonedSymfony-bundle[Image &amp; Media](/categories/media)

fulgurio/image-handler-bundle
=============================

Symfony FulgurioImageHandlerBundle

125PHP

Since Jan 30Pushed 10y ago1 watchersCompare

[ Source](https://github.com/fulgurio/ImageHandlerBundle)[ Packagist](https://packagist.org/packages/fulgurio/image-handler-bundle)[ RSS](/packages/fulgurio-image-handler-bundle/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependenciesVersions (1)Used By (0)

ImageHandlerBundle
==================

[](#imagehandlerbundle)

Image handler bundle use the very helpful [Vich uploader bundle](https://github.com/dustin10/VichUploaderBundle), which allows file upload with annotations.

In the same way, Image handler adds in this bundle a way to handle uploaded picture, like resizing or cropping.

Here is an example of use, with the table field "avatar"

First, add the namespace for annotations :

```
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Fulgurio\ImageHandlerBundle\Annotation as ImageAnnotation;
```

Configure your entity class as explain in Vich Uploader :

```
/**
[...]
 *         @Vich\Uploadable
 */
```

Add a new class member, avatarFile

```
    /**
     * @var Symfony\Component\HttpFoundation\File\UploadedFile
     * @Vich\UploadableField(mapping="avatar_image" fileNameProperty="avatar")
     * @Assert\File(
     *     maxSize="1M",
     *     mimeTypes={"image/png", "image/jpeg", "image/pjpeg"}
     * )
     */
    private $avatarFile;
```

As you'll see, avatarFile is associated to avatar with fileNameProperty

We update the setAvarFile method avatar member, because if entity has no change, file will not be uploaded as well. So we "fake" a change by update ''avatar'' member.

```
    /**
     * Set avatarFile
     *
     * @param \Symfony\Component\HttpFoundation\File\UploadedFile $avatarFile
     */
    public function setAvatarFile(UploadedFile $avatarFile)
    {
        $this->avatarFile = $avatarFile;
        // Because we need an update of User object when form submit a file,
        // we make a fake update of $avatar
        if ($avatarFile)
        {
            $this->setAvatar(time());
        }
        return $this;
    }
```

At the end, you need to add image handler annotation to original field, avatar :

```
    /**
     * @ORM\Column(type="string", length=128, nullable=true)
     *
     * @ImageAnnotation\ImageHandle(mapping="avatar_image", action="resize", width=100, height=100)
     */
    private $avatar;
```

If you want to crop the picture, just replace the action by "crop", and change width of heigth as wanted. You can type 3 fields for each function :

- width (optional): width to resize / crop
- height (optional): height to resize / crop
- mappping (optional): name of config mapping, to set width and height in global config. See above
- action (optional): by default, you'll resize the picture, but "crop" is also available

In app/config/config.yml, just type something like that :

```
fulgurio_image_handler:
    mappings:
        avatar_image:
            width: 400
            height: 400
        second_size:
            width: 200
            height: 200
            action: crop
```

With Vich/UploadBundle, you need to config a mapping name. In my case, it's in @Vich\\UploadableField(mapping="avatar\_image" fileNameProperty="avatar"). If you put in you config file a fulgurio\_image\_handler.mappings.avatar\_image, it will use this settings, so picture will be resize to 400x400. But if you add a mapping settings in ImageHandler annotatin, like @ImageAnnotation\\ImageResize(mapping="second\_size") ImageHandler will crop to 200x200. Groovy !

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/32645bdf6de4e80e4dac9b4a168f4d262f2e1dab629b3d89ee377e62e5cfdd1c?d=identicon)[fulgurio](/maintainers/fulgurio)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/fulgurio-image-handler-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/fulgurio-image-handler-bundle/health.svg)](https://phpackages.com/packages/fulgurio-image-handler-bundle)
```

###  Alternatives

[milon/barcode

Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)

1.5k13.3M39](/packages/milon-barcode)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k23](/packages/bkwld-croppa)[goat1000/svggraph

Generates SVG graphs

132849.6k3](/packages/goat1000-svggraph)[cohensive/embed

Media Embed (for Laravel or as a standalone).

120370.4k](/packages/cohensive-embed)[netresearch/rte-ckeditor-image

Image support in CKEditor for the TYPO3 ecosystem - by Netresearch

63991.3k4](/packages/netresearch-rte-ckeditor-image)[humanmade/tachyon-plugin

Rewrites WordPress image URLs to use Tachyon

87338.5k2](/packages/humanmade-tachyon-plugin)

PHPackages © 2026

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