Save sonata media path in variable branch

I want to save the full image path (sonata media package) to a variable in a branch. Is it possible?

If I write:

{% set pic = path item.image, 'big' %}

it gives me an error: Unexpected token "name" of value "item" (expected "end of statement block") ...

If I write:

{% set pic = item.image %}

then it works, but it only stores the file name, not the full path.

+4
source share
3 answers

Why don't you do it?

{% set rendered %}{% path item.image, 'big' %}{% endset %}
....
Here is my path {{ rendered }}
+3
source

( path() ). . .

+1

Perhaps you can decide:

<img src="{% path media, 'small' %}" data-href="{% path media, 'big' %}">

0
source

All Articles