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

Image alias handling

=20 =20

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 you to define flexible filters in PHP. Image files are = stored using the the IOService, and are completely independent from ezimage Field Type. They are generated only once and cleared on dem= and (e.g. content removal).

Configuration

Image variation (aka "Image alias") definition follows the same format a= s before, in ezplatform.yml or any imported semantic configura= tion file. It's dynamic, so = can be 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 spaces.

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.

LiipImagineBundle supports additional settings, it is possible to combin= e filters from the list above to the ones provided in LiipImagineBundle or custom ones.<= /p>

 

Examples with filters:

With liip filter

For the campaign variation, it is now possible to define the jpeg_= quality setting:

 

=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 al= iases . It is possible to specify them in image alias configurati= on:

=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 i= n LiipImagineBundle  for details.

Drivers

LiipImagineBundle supports GD (default), Imagick and GMagick PHP extensi= ons and only works on image blobs (no command line tool is needed). See the= bundle's d= ocumentation 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
# ezplatform.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

It is possible to use the Liip Imagine console tool to clear generated a= liases.

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

Note : deleting as a group user or not owner of files

Due to a limitation in the Flysystem version required by eZ Platform, im= age variations directories and files are created with a hardcoded permissio= n that prevents group users and users other than the owner from writing or = removing those files/directories.

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).

The naming scheme change introduced by this feature wasn't enabled by de= fault 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 inf= ormation can be found on the pull-request= .

 

 

------=_Part_3043_1599917909.1485851751478--