Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

If Image is found 2 b 404 make it a default image?


Recommended Posts

Hi all,


I am in need of your help yet again!


My supplier will alow me to use images from his server remotly to display imges on my website. This is great except he only has images for about half the products. they are all in the same directory and are named in a logical fashion... such that each image is named "modelnumber.jpg"


now i have figured out how to link to these from the catalog but my question is what code do i need to modify or how could i get it working so that if the image "modelnumber.jpg" is not found... ie 404 it will display a default image that i set... lets say "noimage.jpg" or just simply display no image at all so the customer don't see that the box with the red cross in it (well in ie anyway)


Thanks for all your help!!!!

Link to comment
Share on other sites

You would have to find where the images are being displayed in product_info.php.

Then you would have to include that line into an if statement:


If image_feild =" " // No imgage there

Display "image_not_available.jpg"


display the image by using the existing code



Once you sort out the above bit of code, just make a nice little "Image Not Available" inage to call. Much better that the red "X" which is so unprofessional.

Link to comment
Share on other sites

thanks for the reply John,


I have a question though.


Will this statement work if i actually give the product an image to look for? In othor words.. if i upload (using ep) all the product refering to there own image...


i.e This_product has This_product.jpg


but not all of them actually have an image available on the server will your code still work or is it only going to work if i have not specified an image for the product when i upload it.



Link to comment
Share on other sites

Nothing will work with the suggested code I supplied. It's pseudo code not php. Once written properly in php it should work. What it says idsthis:


If no image exists

Use an image that says "No imgage available for this product" instead.

else (if an image does in fact exist)

Link to comment
Share on other sites


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

  • Create New...