Forum Moderators: open

Message Too Old, No Replies

getting for 404 on a URL at runtime?

can I make sure the image isn't broken

         

httpwebwitch

3:37 pm on Jan 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is a problem that I need to solve:
Amazon's API is returning broken image links.
It looks bad.

For instance, this is one of the images that Amazon is serving to my site:
[images.amazon.com...]

(please excuse my use of an external URL - it's intended to illustrate my point)

Is there a way I can catch these? Ping the URL and see if it exists, or if it is a valid image?

I'm doing all this in C#, .NET

And if that's possible, then is there also a way to grab the height and width of that image to insert into my HTML? (I might ask about this in a separate thread)

thanks,
httpwebwitch

httpwebwitch

3:46 pm on Jan 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hey wait, I just checked the server headers for that request (the URL above) and saw that it's not 404, it's:

HTTP/1.0 200 OK
Server: Apache
Last-Modified: Thu, 01 Jan 1970 00:16:22 GMT
Content-Type: image/gif
X-Pad: avoid browser bug
Content-Length: 807
X-Junk: #*$!xxxxxxx
Date: Thu, 20 Jan 2005 15:38:57 GMT
Connection: keep-alive

When I look at the properties in my browser, it says that the image is a "GIF", which is strange considering the extension is .JPG

When I download that URL, what I get is a 1x1 pixel 256-color GIF.

Maybe the problem is not that the image is 404/broken, but that Amazon is serving duds.

Again, I need to catch these and keep them from being rendered on my web pages. any advice?

beauzero

10:31 pm on Jan 20, 2005 (gmt 0)

10+ Year Member



Try looking at the AWS settings/switches. I haven't looked at it in a while but I think that if there is not an image then you can have them send a filler or the 1x1 image. I use another paid service and this is also an option that they offer.