Home › Forums › Front-end Issues › Image not showing correctly › Reply To: Image not showing correctly
Hi @micromaniac
Because PHP runs on the server and is not browser dependent, the issue cannot be related to a browser.
The fact that it works on ie, and not firefox is down to something else. Perhaps some JS running on the page or some caching going on.
Lets fix your code logically. First, lets debug the value returned by get_field. You can do this by:
<?php
echo '<pre>';
print_r( get_field('image_bloc_2') );
echo '</pre>';
die;
?>
What do you get from that?
Next is to debug the returned value from the wp_get_attachment_image_src function.
What do you get for that?
You can find docs on that function here:
http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src
Please note that this function returns an array and the src is actually at $image[0]. This means that your code won’t work because you are trying to echo an array.
Please read over the image field documentation to get a better understanding of how to use this function.
Thanks
E
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
🚀 This week’s session of ACF Chat Fridays dips into the preliminary results of our first ever user survey. Don’t miss it! https://t.co/3UtvQbDwNm pic.twitter.com/kMwhaJTkZc
— Advanced Custom Fields (@wp_acf) May 9, 2023
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.