Liip Imagine bundle, resize and crop your images in Symfony

Web hints
4 min readNov 18, 2018

The Liip Imagine Bundle

The main component we will be using for this tutorial is the liip imagine bundle, this bundle can be used in Symfony as an image resize/cropper tool and much more.

To resize and crop an image the following happens: 1. You as a developer needs to set up Liip Imagine filters, more about this later 2. The developer needs to add a filter to the image, for example: {{ 'https://www.placehold.it/350x350'|imagine_filter('square_image') }} 3. The bundle will use this filter to generate a custom route for this image 4. As soon as you visit that page the liip imagine controller for that route will generate and return an image with the specifications of that filter square_image. 5. Don't worry, the liip imagine filter doesn't do this everytime, once the image is created it's stored in the cache and just returns that image next time.

Installation of the bundle

For a more detailed installation/configuration you can always visit the developer’s documentation on Github

To download the package in your project use composer. The package is called liip/imagine-bundle so the composer command is:

composer require liip/imagine-bundle

--

--

Web hints

From basic to advanced web developer hints and tutorials for SEO, Symfony, HTML & CSS, and use of tools.