Is there a way of having the script use a default "image not available" gif if the fetured product image is unavailable/404? Can this be achieved with php?
Reason why i ask, is that it seems quite a few products seem to have images that don't exist and it looks unattractive to get just the alt text instead.
Figured it!
Use getimagesize() and it will return false if the image is not found :) I now have none.gif images showing if they are missing!
Any chance of sharing the changes you mage to solve this.
thanks
Hi Murph,
What timeout did you use to allow the image a chance to load before deciding if it there was an error?
Cheers,
David.
Yes, i actually just blogged about it here
re: David - i didn't!! It seems to be working ok though for me...
Ah I see what you're doing... a server side check prior to rendering the page. That makes sense - but worth keeping an eye on the bandwidth use on your server - as this method would incur a request for every image on every page requested - including search engine crawls!
Thanks for the link....
Cheers,
David.
I'm actually currently only using it for my frontpage where my featured products are, so this shouldn't be too much of a problem. I just didn't like the untidyness of some products showing images, others showing alt text...messing up my display! But i agree if i were using it on every product page...
Hi,
That's not straight forward i'm afraid as at the time the page is generated you don't know whether the image is 404 or not. We have discussed this in the past, it might be possible to do something with JavaScript or CSS but it never got as far as any code. With your featured products, the best recommendation I think is to pick featured products with known good images from a fast server - that should look Ok pretty much all the time...
Cheers,
David.