ainoy31 Posted July 12, 2008 Share Posted July 12, 2008 Hello- I have a site where it displays an image of a product dynamicly. I have encounter a few products that do not have a picture for them yet. So, it shows the ugly white box with the red cross. Yes, I am using the alt tag to display the text message as well. I am wondering is there is way to display say a default image if no image is found on the server? Thanks, Ainoy Link to comment https://forums.phpfreaks.com/topic/114383-solved-image-display/ Share on other sites More sharing options...
vikramjeet.singla Posted July 12, 2008 Share Posted July 12, 2008 create a dummy image says "no image" for products having no image.... while you are displaying products with images check whether image exists for product like $imagepath = "/path/to/product/image/dir/"; $productimage = $row['product_image']; if(is_file($imagepath.$productimage) && file_exists($imagepath.$productimage)){ // display image of the product } else { // display dummy image } cheers!!!!!! Link to comment https://forums.phpfreaks.com/topic/114383-solved-image-display/#findComment-588199 Share on other sites More sharing options...
ainoy31 Posted July 12, 2008 Author Share Posted July 12, 2008 Thanks for the advice man. I had to play around with it and it worked. Link to comment https://forums.phpfreaks.com/topic/114383-solved-image-display/#findComment-588209 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.