The images of two websites are currently hosted on a CDN. We would like local images are loaded if CDN host is not available. Two different solutions must be develop due to the Drupal versions of the websites (Drupal 6 and Drupal 7)
How to know when the CDN is unavailable? The idea is trying to get the same image every period of time (every minute). It can be the website logo or the favicon. If you get a 404 error you consider the CDN is unavailable. An script outside drupal is necessary.
*Regarding Drupal 6 website, template was changed to the images were uploaded from CDN. A solution similar to the one that is described at [url removed, login to view] was applied.
So, when CDN is not available, template must be replaced, cache must be cleared, and you must save anywhere the template was be replaced to avoid do the same action several times (every minute)
*Regarding Drupal 7 website, a new module was developed and installed to support CDN. When CDN is not available module must be deactivated, and cache and boost must be cleared. Again, you should save the module was deactivated and it must be activated once the CDN is available.