Global navigation

   Documentation Center
   eZ Studio & eZ Platform
     User Manual
     Technical Manual
     Glossary
   eZ Publish 4.x / legacy

 
eZ Publish (5.x)

eZ Publish 5.x | For eZ Platform & eZ Studio topics see Technical manual and User manual, for eZ Publish 4.x and Legacy topics see eZ Publish legacy

Skip to end of metadata
Go to start of metadata

Version compatibility

This feature is available since eZ Publish 5.4 / 2014.11

Description

Image aliases are generated with LiipImagineBundle, using the underlying Imagine library from avalanche123. This bundle supports GD, Imagick or Gmagick PHP extensions, and allows to define flexible filters in PHP. Imagefiles are stored using the the IOService, and are completely independent from ezimage FieldType. They are generated only once and cleared on demand (e.g. content removal).

Configuration

Image variation (aka "Image alias") definition follows the same format as before, in ezpublish.yml or any imported semantic configuration file. It's dynamic, so can be configured per site access and all the other scopes.

Important: Each variation name must be unique. It may contain _ or - or numbers, but no space.
  • reference: Name of a reference variation to base the variation on. If null (or ~, which means null un YAML), the variation will take the original image for reference. It can be any available variation configured in ezpublish namespace, or a filter_set defined in liip_imagine namespace.

  • filters: array of filter definitions (hashes containing name and params keys). See possible values below.

Available filters

In addition to filters exposed by LiipImagineBundle, the following are available:

Filter nameParametersDescription
geometry/scaledownonly[width, height]Generates a thumbnail that will not exceed width/height.
geometry/scalewidthdownonly[width]Generates a thumbnail that will not exceed width.
geometry/scaleheightdownonly[height]Generates a thumbnail that will not exceed height.
geometry/scalewidth[width]Alters image width. Proportion will be kept.
geometry/scaleheight[height]Alters image height. Proportion will be kept.
geometry/scale[width, height]Alters image size, not exceeding provided width and height. Proportion will be kept.
geometry/scaleexact[width, height]Alters image size to fit exactly provided width and height. Proportion will not be kept.
geometry/scalepercent[widthPercent, heightPercent]Scales width and height with provided percent values. Proportion will not be kept.
geometry/crop[width, height, startX, startY]Crops the image. Result will have provided width/height, starting at provided startX/startY
border[thickBorderX, thickBorderY, color=#000]Adds a border around the image. Thickness is defined in px. Color is "#000" by default.
filter/noise[radius=0]Smooths the contours of an image (imagick/gmagick only). radius is in pixel.
filter/swirl[degrees=60]Swirls the pixels of the center of an image (imagick/gmagick only). degrees defaults to 60°.
resize{size: [width, height]}Simple resize filter (provided by LiipImagineBundle).
colorspace/grayN/AConverts an image to grayscale.

Tip: LiipImagineBundle supports additional settings, it is possible to combine filters from the list above to the ones provided in LiipImagineBundle or custom ones.

 

Examples with filters:

With liip filter

It is now possible to define the jpeg_quality setting. This configuration adds a limit to the image quality using a liip filter.

 

 

With ezpublish filter

Using the geometry/scalewidth filter

 

 

 

Discarded filters

The following filters have been discarded due to incompatibility:

  • flatten. Obsolete, images are automatically flattened.
  • bordercolor
  • border/width
  • colorspace/transparent
  • colorspace

Custom filters

Please refer to LiipImagineBundle documentation on custom filters. Imagine library documentation may also be useful.

Post-Processors

LiipImagineBundle supports post-processors on image aliases. It is possible to specify them in image alias configuration:

Please refer to post-processors documentation in LiipImagineBundle for details.

Drivers

LiipImagineBundle supports GD (default), Imagick and GMagick PHP extensions and only work on image blobs (no command line tool is needed). See the bundle's documentation to learn more on that topic.

Upgrade

  • Instantiate LiipImagineBundle in your kernel class

If you were using ImageMagick, please install Imagick or Gmagick PHP extensions and activate the driver in liip_imagine (see LiipImagineBundle configuration documentation for more information):

GD will be used by default if no driver is specified.

Purging aliases

ADDED IN 5.4.3 / 2015.05

Starting from the 5.4.3 and 2015.05, eZ Platform handles aliases on its own. It is possible to use the Liip Imagine console tool to clear generated aliases.

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

Note that the naming scheme change introduced by this feature isn't enabled by default on 5.4.x. An alternative purge process has been implemented, that takes much more time, but is compatible with the existing format. More technical information can be found on the pull-request.

 

2 Comments

  1. Liip has changed the documentation files format (.md -> .rst). So, the actual links don't work.

  2. Mathieu Maury Thanks for the information, I updated the links.