Get in image_size parameter

I am trying to use an variable image size like so

<Set my_image_size>thumbnail</Set>
<img
src="{Field image_url size='{Get my_image_size}'}"
alt="{Field title}"
class="img-responsive"
/>

also tried

src="{Field image_url}" size="{Get my_image_size}"

The image is showing but the size wont apply. Where is the error in my syntax?

I think the difficulty here is passing a dynamic tag Get as an attribute to another dynamic tag Field, all inside an HTML attribute.

It might be solved by moving the template expression outside the HTML attribute, using a variable to pass the result.

<Set image_url><Field image_url size="{Get my_image_size}" /></Set>

<img src="{Get image_url}" />
1 Like