...

View Full Version : Image availability



dallen24
08-23-2004, 07:11 PM
Hi. Got a question. If my web site grabs an image from another site (example: current moon phase from us naval observatory), is there a way to tell if that image isn't available?

I could load an image object in javascript and check it with a 5 minute timeout loop (if you can get the user to wait that long).

My browser seems to know when it can't get the image (shows a blank box with the little x in the upper left corner). Anyway I could tell if the browser gave up?

Willy Duitt
08-23-2004, 07:34 PM
Unless you have permission. It is not polite to be hot linking to someone elses images....

You should at least set up some type of ftp program to download the images to your server at regular intervals (again, with permission).... this way, you woud not be hot linking and you would not need to worry about the images being available...

And FWIW, although I doubt the National Observatory will do this, but the times I catch someone hot linking my images I replace them with an image which will certainly embarrass the hot linker....

.....Willy

dallen24
08-23-2004, 09:35 PM
Unless you have permission. It is not polite to be hot linking to someone elses images....
.....Willy

http://tycho.usno.navy.mil/cgi-bin/phase.gif is a public service link. It's expected to be hot linked by astronomy clubs and other related groups. The demain for it is so high, however, that sometimes it's not available.

I want to know when the browser gives up trying to grab this image so I can display something else...Dennis

jbot
08-23-2004, 11:25 PM
they might expect people to download the image - after all, what else happens to images posted onto websites - but it's quite another to expect users to hotlink directly to the image, and thereby engender massive bandwidth overheads.

in any case, that's between you and them.

as far as checking for availability, you can do this:


<img src="whatever_url.gif" onerror="this.src='another_url.gif'"/>

hope that helps :D

Kor
08-24-2004, 09:40 AM
You should at least set up some type of ftp program to download the images to your server at regular intervals


Or use a server-side application. I've saw such applications built in php and in java.

jbot
08-24-2004, 10:16 AM
Or use a server-side application. I've saw such applications built in php and in java.

yeah, basically spider the site for the images. :D

dallen24
08-24-2004, 09:30 PM
as far as checking for availability, you can do this:


<img src="whatever_url.gif" onerror="this.src='another_url.gif'"/>

hope that helps :D

Thanks...Dennis



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum