Message-ID: <304265134.2904.1485851195560.JavaMail.confluence@ip-10-127-227-164> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_2903_1574833233.1485851195560" ------=_Part_2903_1574833233.1485851195560 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html Image alias handling

Image alias handling

Version compatibility

This feature is available since eZ Publish 5.4 / 2014.11=

*/#Imagealiashandling-Des= cription#Imagealiashandling-DescriptionC">

Description

Image aliases are generated with LiipImagineBun= dle, using the underlying Imagine library from aval= anche123. This bundle supports GD, Imagick or Gmagick PHP extensio= ns, and allows to define flexible filters in PHP. Imagefiles are store= d using the the IOService, and= are completely independent from ezim= age 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 a= s before, in ezpublish.yml or any imported semantic configurat= ion file. It's dynamic, so can b= e configured per site access and all the other scopes.

=20
# Example
ezpublish:
    system:
        my_siteaccess:
            image_variations:
                small:
                    reference: null
                    filters:
                        - { name: geometry/scaledownonly, params: [100, 160=
] }
                medium:
                    reference: null
                    filters:
                        - { name: geometry/scaledownonly, params: [200, 290=
] }
                listitem:
                    reference: null
                    filters:
                        - { name: geometry/scaledownonly, params: [130, 190=
] }
                articleimage:
                    reference: null
                    filters:
                        - { name: geometry/scalewidth, params: [770] }=20
Important: Each variation name=20 must be unique. It may contain=20 _ or=20 - or numbers, but no space.

Available filters

In addition to filters exposed by LiipImagineBundle, the following are availabl= e:

Filter name Parameters Description
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 heigh= t.
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 va= lues. 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=3D#000] Adds a border around the image. Thickness is def= ined in px. Color is "#000" by default.
filter/noise [radius=3D0] Smooths the contours of an image (imagick<= /code>/gmagick only). radius is in pixel.
filter/swirl [degrees=3D60] Swirls the pixels of the center of an image (imagick/gmagick only). degrees defaults= to 60=C2=B0.
resize {size: [width, height]} Simple resize filter (provided by LiipImagineBun= dle).
colorspace/gray N/A Converts an image to grayscale.

Tip: LiipImagineBundle supports additional settings, it is poss= ible 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.

 

=20
ezpublish:
    system:
        my_siteaccess:
            image_variations:
                reduced_jpeg:
                    reference: null
                    filters:
liip_imagine:
    driver: imagick
    filter_sets:
        mediumimage:
            jpeg_quality: 50
=20

 

With ezpublish filter

Using the geometry/scalewidth filter

 

=20
ezpublish:
    system:
        my_siteaccess:
            image_variations:
                mediumimage:
                    reference: null
                    filters:
                       - geometry/scalewidth:
=09=09=09=09=09       params: [770]
=20

 

 

Discarded filters

The following filters have been discarded due to incompatibility:

Custom filters

Please refer to LiipImagineBundle documentation on custom filter= s. Imagine library documentation may also be us= eful.

Post-Processors

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

=20
ezpublish:
    system:
        my_siteaccess:
            image_variations:
                articleimage:
                    reference: null
                    filters:
                        - { name: geometry/scalewidth, params: [770] }
                    post_processors:
                        jpegoptim: {}
=20

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

Drivers

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

Upgrade

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

=20
# ezpublish.yml or config.yml
liip_imagine:
    # Driver can either "imagick", "gmagick" or "gd", depending on the PHP =
extension you're using.
    driver: imagick
=20

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.

=20
$ php ezpublish/console liip:imagine:cache:remove --filters=3Dlarge
$ php ezpublish/console liip:imagine:cache:remove -v
=20

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

Note that the naming scheme change introduced by this feature isn't enab= led 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. Mor= e technical information can be found on the pull-request.

 

------=_Part_2903_1574833233.1485851195560--