Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Jun 2002
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Image availability

    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?

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #3
    New Coder
    Join Date
    Jun 2002
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Willy Duitt
    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

  • #4
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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:

    Code:
    <img src="whatever_url.gif" onerror="this.src='another_url.gif'"/>
    hope that helps
    *keep it simple (TM)

  • #5
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    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.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #6
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Kor
    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.
    *keep it simple (TM)

  • #7
    New Coder
    Join Date
    Jun 2002
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by jbot
    as far as checking for availability, you can do this:

    Code:
    <img src="whatever_url.gif" onerror="this.src='another_url.gif'"/>
    hope that helps
    Thanks...Dennis


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •