Jump to content

[SOLVED] Image Display


ainoy31

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.