Symfony 2 AvalancheImagineBundle图像滤镜

时间:2012-10-22 19:54:50

标签: php symfony twig

输入:

{% for car in closet %}
<img src="{{ asset('images/') }}{{ car.photo1 }}" />
{% endfor %}

html输出:

<img src="/images/1bb8cee7cd58403ba84daee67d82fa869ec6052d.jpeg" />

如何从AvalancheImagineBundle中应用此功能:

<img src="{{ '/relative/path/to/image.jpg' | apply_filter('my_thumb') }}" />

我无法解决这个问题,因为路径和文件名是分开的

1 个答案:

答案 0 :(得分:3)

简单地:

<img src="{{ (asset('images/') ~ car.photo1) | apply_filter('my_thumb') }}" />