eab/image-filter-bundle

A bundle for eZ Publish that provides filters for use in image variations / aliases

0.9.4 2017-06-05 13:42 UTC

README

Summary

eZ Publish 5 bundle for image variation filters.

So far only 1 filter is provided: thumbnailgravityfilter/center.

Copyright

Based on Image aliases and filters in eZ Publish 5.4+. Many thanks Thiago for this useful tutorial!

License

Licensed under GNU General Public License 2.0

Requirements

Requires eZ Publish 5.4 or above.

Installation

  1. Either install using composer:
composer require --update-no-dev --prefer-dist eab/image-filter-bundle

or install the source as a submodule using git:

git submodule add https://github.com/eab-dev/ImageFilterBundle src/Eab/ImageFilterBundle
  1. Edit the function registerBundles() in ezpublish/EzPublishKernel.php and add the line:
 new Eab\ImageFilterBundle\EabImageFilterBundle(),

to the array of bundles. Save it.

Usage

  1. Configure your own image variations/aliases in your bundle's image_variations.yml. For example:
    system:
        default:
            image_variations:
                my_nice_thumbnail:
                    reference: ~
                    filters:
                        - { name: thumbnailgravityfilter/center, params: [300, 300] }
  1. Use in your templates:
    {% set thumbnail_image = ez_image_alias( content.getField( 'image' ), content.versionInfo, 'my_nice_thumbnail') %}
    <img class="responsive" src="{{ thumbnail_image.uri }}">