Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Error image
This topic contains 2 replies, has 2 voices, and was last updated by jonadeis 8 years, 2 months ago.
- AuthorPosts
- January 7, 2015 at 10:26 pm #3414
I created another search box, in “image options/primary image source”, I selected custom field and in “Custom field containing the image” I typed imagen_de_publicacion, i created the field with advanced custom field pro, but when it shows the results, the image doesn’t appear, and in the console it shows this error Resource interpreted as Image but transferred with MIME type text/html: “http://www.afsdp.org.pe/leguia-la-historia-oculta/610/”..
I noticed that in “Available public custom fields types”, the “imagen_de_publicacion” field appears, so i would like your help.
Thanks in advance
January 8, 2015 at 10:10 am #3416Hi!
This sounds like the image field does not actually contains the image url, but something else. The MIME type error indicates that the browser interpeted it as text, which usually means, that the image url is incorrect.
Moreover the url “http://www.afsdp.org.pe/leguia-la-historia-oculta/610/” is definitely not an image url, it just points to one of your pages.
After diggin up some old tickets I found a similar issue solved for someone. The ACF actually does not store the image url, but the image ID. Thus you need some post-processing function in order to make it work.
This is what solved the issue for him. Put the following code into your themes functions.php file:
Best,add_filter( "asp_result_image_after_prostproc", "asp_cf_image", 1, 1 ); function asp_cf_image( $image ) { if ($image != "" && strlen($image) < 10) { $atts = wp_get_attachment_image_src( $image ); if (isset($atts[0])) return $atts[0]; return null; } return $image; }
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
January 9, 2015 at 2:56 pm #3426thank you very much, the problem is solved
- AuthorPosts
You must be logged in to reply to this topic.