Force Image Caching

learning_brain

New Member
Messages
206
Reaction score
1
Points
0
I have an image preview page that dynamically shows the first 10 images from a database using a loop. The viewer can then pass/fail an image using form method.

I have done 10, because I only use large images and I wanted to speed the process up. I assumed that if one image was loaded, it would cache it so that on submit, it would already be loaded and only load the next image (number 11).

But.... it's always re-loading each image...

I have looked at header controls and found plenty of reference to forcing of cache reload, but not force cache.

I am forced to think this is browser specific, but each image is only 500kb-2MB and it still re-loads.

Is this because they are hot-linked images?

What gives?
 
Last edited:

marshian

New Member
Messages
526
Reaction score
9
Points
0
You're right, as far as I can find in http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html , there is no way to actually force the client to cache anything. Caching is only ever allowed or prohibited, never required.

It could very well be browser-specific that your browser always reloads all images. Section 14.9.4 of the document I've linked explains some of the mechanisms a client can use to force reloading the cache. However, each browser will have his own set of rules for that.

All together, unless I'm mistaking there is no way to do that using only standard http caching mechanisms. You could however look into different possibilities. For example, a Java applet or Flash element could implement its own cache. Using Javascript and making your page dynamic would also be a possibility. There's no modern browser that's going to refresh the entire page if you add a node to the HTML tree.
 

learning_brain

New Member
Messages
206
Reaction score
1
Points
0
Aha!! an answer... thank you.

I like the javascript idea, although I have made some other amendments to supplement it.

Now, every image, pending or otherwise gets a thumbnail generated automatically.

The review page now loads multiple thumbnails, with a javascript hover script to load up the original if required... much like the index page. This allows me to fail (and delete unecessary thumb) or pass lots of images quickly.

My problem ATM is that the crawler is pulling in so many images, I don't have the time to keep up with it. This will certainly help.

Thanks again
 
Top