I’m trying to cache a giant and slow source of photos but on an as-needed basis.
I was thinking of using mod rewrite and php routing to capture a url like
/photos/http://original.com/foo.jpg and then check my local db or hd for
foo.jpg and return that or some how tell the browser to use the original
http://original.com/foo.jpg meanwhile PHP downloads foo.jpg locally so the next time that photo is requested it comes from my server which is much faster than the original server.
Can anyone give advice on how to go about doing this? Would the PHP involved be just as slow as the originating slow server and not worth doing?