ACF Image size without a loop

Hi everyone!

I’m trying to output an ACF Image with a thumbnail size.

This works fine:

<Loop acf_image=my_acf_image>
  <img src="{Field url size=thumbnail}">

This doesn’t, the image is full size:

<img src="{Field acf_image=my_acf_image field=url size=thumbnail}">

Is it possible with the second code (no loop)?

If I’m understanding the docs for attachment loop fields, it says “url - Accepts optional attribute “size” for image size.” So size is an optional attribute that works with the url attribute. In your first example, you have a url attribute so the size attribute works, but in your second example, you aren’t actually using the url attribute so that’s why it’s not working. I’m not sure if this is a technical limitation or if simply an oversight when the team designed that Field acf_image shortcut so I’ll check in with the devs to see if it’s possible to allow that second syntax to work. Hopefully this explains why it currently doesn’t work.

Hi @benjamin,

Fine analysis, thank you.
You’re probably right about the logic underlying, and it’s not a big deal given the first syntax works alright (despite it’s less compact than the second one ;-).

Turns out this has already been addressed in the upcoming release (3.0.0) so look out for that in the coming days!

1 Like

Wow, good news, thanks! :wink:

1 Like

@avanti I just wanted to follow up here to let you know that version 3.0.0 has been released so this should now be resolved.

1 Like

Great, thanks you, i will test that!