Access ACF Gallery Field img src for a single image

I have an ACF Gallery field set up:

In my layout I have a DC looper provider set up:
Screenshot 2025-02-28 at 1.39.25 PM

I am then consuming it as a column.
Now, in each column is an image element that is using {{dc:looper:item}} as the src and using the same string for the alt text: {{dc:looper:item}}:

Screenshot 2025-02-28 at 1.41.26 PM

Here is the output when viewing page source:
<img src="https://testdomain.com/wp-content/uploads/2025/02/Dummy-5-e1.jpg" width="200" height="200" alt="585" loading="lazy">

Notice that the same Dynamic Content string outputs the full path of the image when used in the src field but when used in a text field like “alt”, it outputs the ID of that image.

I obviously don’t really want to use this as the alt text but I do need the URL of the image for other reasons I intend to use in my loop. But this behavior is frustrating. And the documentation for ACF Multi Dimential fields is unclear about how to reliably retrieve the URL of the image itself in a case like mine.

I have already tired changing the Return Format and to no avail. I also do not want to change the return format as array seems to afford me the most options. Can someone please let me know what I need to do to get this done?

I do think the docs could illuminate this concept better than it does currently. Please help asap.

Thanks in advance.

Hello @simeoned,

To help you with your concerns we need to check your settings, I would request please share the admin login details meanwhile I would suggest you troubleshoot a few of the common issues before we investigate your settings. Please share your details in a secure note. Please provide the following details

  • WordPress Login URL
  • Admin-level username and password
  • Exact page URL

You can find the Secure Note button at the bottom of your posts

Thanks

Secure note created. There are no issues with this installation in terms of conflicts or anything like that. This is a pretty vanilla install and I’m asking for the details of how to retrieve the URL of an image stored in an ACF Gallery field.

So I have solved the problem with this. It would appear that the system is only able to get this information after the post is published. It would not work while in draft for some reason. That seems very odd to me.

End of the day, this is the dc string I needed: {{dc:looper:field key="url"}}

Again, why does this only work when the post is published?

Hello @simeoned,

The image field returns an image array. When the post is still in draft, the post meta will not be save yet. If unsure what to use, you can always utilize {{dc:looper:debug_consumer}} to display the fields that the looper consumer will ouput visibly.

Hope this helps.

All using {{dc:looper:debug_consumer}} does is give me an icon of a bug. How do I see what data is available?

Never mind. I see now that you click on it. That wasn’t working for me to begin with because the div I placed the debugger in was set to an <a> tag and was itself a link. So… that’s why I didn’t notice that.

Thanks.

You are most welcome @simeoned