If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.
Is there any way to cache images on a site so they dont reload everytime the page is accessed?
My bandwidth is climbing in the images usage.
I could be wrong on this, but I think caching would only work to speed up the transfer of bytes from the server to your visitor's browser. The image size would be the same in the cache as it is on disk, and you are sending that same number of bytes to the user's browser ... just faster.
Check your AWStats to see if you are being visited by Google's image search bot. I found they were using more bandwidth than my users. And I don't really want the images on my site indexed by Google anyway. So in my robots.txt file (placed in public_html) I added the lines:
One thing you may try is telling the visiting browsers to cache the images on their side avoiding repeated requests.
This is what I use (goes into .htaccess):
It would help if we could also control cache-enabling headers to the various downstream caches (ISPs, corporate gateways and such) but as far as I can tell this woul require the mod_headers module to be enabled, which is not the case at DIS - I believe (mod_header instructions in .htaccess gave a server error, last time I tried). Hint: Andrew, would you thing about this? It's not some exotic module - mod_headers has been around for some time now...
It tells the browser to keep the image for a month (written in seconds) - A means start counting at download time, while M would have meant since "Last-Modified".
The Apache docs explain it well at:
Comment