I’m new to using the flexible content add-on and totally loving it. Elliot, amazing work!
I need to specify an image size for an image field (specifically ‘medium’) but am not sure how to go about that. Here’s the code for my image field:
elseif( get_row_layout() == 'images' ):
$image = get_sub_field('image');
echo '<img src="' . $image['url'] . '" alt="' . $image['alt'] . '" />';
endif;
Can anyone tell me how to include an image size in the above? I’ve looked at examples online for selecting image sizes but I don’t know how to do it for a flexible content sub-field.
Thanks in advance!
Hi @dadra
This can be achieved no different to that of a regular field:
http://www.advancedcustomfields.com/resources/field-types/image/
You can echo a size like so:
echo '<img src="' . $image['sizes']['thumbnail'] . '" alt="' . $image['alt'] . '" />';
Ah hah! That did it. Thanks so much Elliot.