ACF Repeater field doesn’t output images

I am using ACF repeater plugin on my wordpress site to generate simple gallery. this si the code in my tempalte file:

<?php if( have_rows('gallery') ): ?>
<ul class="slides">                              
  <?php while( have_rows('gallery') ): the_row();                        
  // vars
  $image = get_sub_field('gallery_images');                          
  ?>    
<li class="slide">                                   
  <img src="<?php echo $image['url']; ?>" alt=""/>               
</li>                                
<?php endwhile; ?>                               
</ul>                                
<?php endif; ?>

And this is html output on frontpage:

Read More
<ul class="slides">                                 
 <li class="slide"><img alt="" src="h"></li>
</ul>

The image src outputs “h”… I have double checked and the sub_field “slider_images” is set to be Image URL.
I copied the code from documentation, didn’t change anything.
What am I missing?

Related posts

Leave a Reply

1 comment

  1. If you’re outputting the URL from the ACF directly, I don’t think you need the echo $image['url'] anymore. echo $image will do.

    You should use while(have_rows('gallery_images')) and get_sub_field('url') then echo $image