Hello,
To return a medium size images in repeater field, I followed instructions from Jonathan from this post:
custom image sizes
but the code posted by Jonathan doesn’t work.
I set the image to Object in repeater field, this is my code:
<?php while( have_rows('repeater') ): the_row();
$image_1 = get_sub_field('image');
<?php if($image_1): ?>
<img src="<?php echo $image_1['sizes']['medium']; ?>" style="max-width:300px;" alt="" />
<?php endif; ?>
<?php endwhile; ?>
when I remove [‘sizes’][‘medium’] it works fine, so the code works fine, just the sizes are causing issue.
What’s the problem? Should there somewhere be [‘url’] added?
Hi @fanta00
I responded to you there but we can keep going here instead so as to keep this issue separate!
Have you tried resaving the post/page with the image and also make 100% sure that you’ve set the image return value to “object”?