eab / image-filter-bundle
为eZ Publish提供的过滤器包,用于图像变体/别名中
0.9.4
2017-06-05 13:42 UTC
Requires
- ezsystems/ezpublish-kernel: ~5.4|~6.5|>=2014.11
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提供的这个有用的教程!
许可证
要求
需要eZ Publish 5.4或更高版本。
安装
- 使用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
- 编辑
ezpublish/EzPublishKernel.php
中的函数registerBundles()
并在数组中添加以下行
new Eab\ImageFilterBundle\EabImageFilterBundle(),
保存更改。
用法
- 在您的包的
image_variations.yml
中配置自己的图像变体/别名。例如
system: default: image_variations: my_nice_thumbnail: reference: ~ filters: - { name: thumbnailgravityfilter/center, params: [300, 300] }
- 在模板中使用
{% set thumbnail_image = ez_image_alias( content.getField( 'image' ), content.versionInfo, 'my_nice_thumbnail') %} <img class="responsive" src="{{ thumbnail_image.uri }}">