eab/image-filter-bundle

为eZ Publish提供的过滤器包,用于图像变体/别名中

0.9.4 2017-06-05 13:42 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:09:43 UTC


README

摘要

eZ Publish 5的图像变体过滤器包。

目前只提供1个过滤器:thumbnailgravityfilter/center

版权

基于eZ Publish 5.4+中的图像别名和过滤器。非常感谢Thiago提供的这个有用的教程!

许可证

遵循GNU通用公共许可证2.0

要求

需要eZ Publish 5.4或更高版本。

安装

  1. 使用composer安装
composer require --update-no-dev --prefer-dist eab/image-filter-bundle

或使用git将源代码作为子模块安装

git submodule add https://github.com/eab-dev/ImageFilterBundle src/Eab/ImageFilterBundle
  1. 编辑ezpublish/EzPublishKernel.php中的函数registerBundles()并在数组中添加以下行
 new Eab\ImageFilterBundle\EabImageFilterBundle(),

保存更改。

用法

  1. 在您的包的image_variations.yml中配置自己的图像变体/别名。例如
    system:
        default:
            image_variations:
                my_nice_thumbnail:
                    reference: ~
                    filters:
                        - { name: thumbnailgravityfilter/center, params: [300, 300] }
  1. 在模板中使用
    {% set thumbnail_image = ez_image_alias( content.getField( 'image' ), content.versionInfo, 'my_nice_thumbnail') %}
    <img class="responsive" src="{{ thumbnail_image.uri }}">