You are here:  » If featured product images are 404...

Support Forum



If featured product images are 404...

Submitted by murph on Fri, 2006-10-13 11:50 in

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.

Submitted by support on Fri, 2006-10-13 14:15

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.

Submitted by murph on Sat, 2006-10-21 18:56

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!

Submitted by wilkins on Sun, 2006-10-22 09:17

Any chance of sharing the changes you mage to solve this.

thanks

Submitted by support on Mon, 2006-10-23 11:56

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.

Submitted by murph on Mon, 2006-10-23 12:03

Yes, i actually just blogged about it here

re: David - i didn't!! It seems to be working ok though for me...

Submitted by support on Mon, 2006-10-23 12:16

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.

Submitted by murph on Mon, 2006-10-23 12:22

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...

Submitted by noodles on Mon, 2006-10-23 16:05

There's an excellent javascript method here I've used it for a couple of years now on several sites with no issues.

Dave