Image variations (image aliases) enable you to define and use different versions of the same image. You generate variations based on filters which modify aspects such as size and proportions, quality or effects.

Image variations are generated with LiipImagineBundle, using the underlying Imagine library from avalanche123. This bundle supports GD (default), Imagick or Gmagick PHP extensions, and enables you to define flexible filters in PHP. Image files are stored using the IOService, and are completely independent from the Image Field Type. They are generated only once and cleared on demand (e.g. on content removal).

Each variation name must be unique. It may contain underscores (_), hyphens (-) or numbers, but no spaces.

The following parameters are set for each variation:

reference: Name of a reference variation to base the variation on. If set to null (or ~, which means null in YAML), the variation will take the original image for reference. It can be any available variation configured in the ezpublish namespace, or a filter_set defined in the liip_imagine namespace.

The first example will clear the image files for the large variation. The second will clear all the generated variations (be careful), and list the removed files (-v).

Note

The naming scheme change introduced by this feature wasn't enabled by default on 5.4.x. As part of migration you'll need to adapt to the new schema to get the benefit of this more efficient purge method. More technical information can be found on the pull request.

Code injection in image EXIF

EXIF metadata of an image may contain e.g. HTML, JavaScript, or PHP code. eZ Platform is itself does not parse EXIF metadata, but third-party bundles need to be secured against this eventuality. Images should be treated like any other user-submitted data - make sure the metadata is properly escaped before use.

You can use LiipImagine's liip:image:cache:resolve script to resolve the path to image variations generated from the original image, with one or more paths as arguments. See LiipImagineBundle documentation for more information.

Note that paths to repository images must be relative to the var/<site>/storage/images directory, for example: 7/4/2/0/247-1-eng-GB/test.jpg.