3

I am considering moving my website's images to a separate host (such as imgur) in order to cut down on bandwidth use. Are there any techniques I can use to guarantee that the images will still be shown even if the primary host is down? I am thinking of something along the line of what is possible to do with Javascript, where you can check if the first script tag loaded and dynamically insert another one if it didn't work.

In my particular case the images appear both as regular HTML IMG tags and as background images, with the URLs in CSS stylesheet.

hugomg
  • 68,213
  • 24
  • 160
  • 246

1 Answers1

2

The only way to do this would be with JavaScript. I really don't think this is a problem you need to worry about.

Also, you should know that you cannot use Imgur for a mirror for your site's images. It is against their terms of service.

Community
  • 1
  • 1
Brad
  • 159,648
  • 54
  • 349
  • 530
  • Can you extend that onLoad method you mentioned to also work on the stylesheet background images? I know this is kind of pointless in the long run, but Im getting curious :). As for the term of services bit, its kind of a contrived example but anyway, I only see rules against copyrighted and hate material on it: http://imgur.com/tos – hugomg Dec 30 '12 at 23:25
  • 1
    If you really wanted to do this, I would load all of the images with JavaScript (just like a pre-loader) and assign your styles from there. That's probably the easiest method. You're right, I don't see anything in their ToS at the moment. I was looking at this a couple weeks back and definitely read that they don't allow it. Either they changed their terms, or I can't find the part on their site that disallows mirroring your site's images. – Brad Dec 30 '12 at 23:35