Welcome Guest, Not a member yet? Register   Sign In
How do I cache my images? I put $this->output->cache(100) but it is not working
#2

[eluser]Unknown[/eluser]
What Google Page Speed is telling you is, that you require expire headers, which are used by the browser to identify for how long it should keep the files in its cache without checking if they had changed.

Okay, so.
If you manage to somehow get access to your .htaccess file, you may set the following rule:
Code:
<FilesMatch "\.(ico|jpg|jpeg|png|gif)$">
Header set Cache-Control "max-age={NUM_SECONDS}, public"
</FilesMatch>
Where {NUM_SECONDS} is equal to how long images should stay in browsers cache after the first visit. (in seconds), lets say: "3600" for 1 hour after first time view.

If however, you don't have access to the htaccess file, php needs to stream out the files and add headers to them. But if you are just starting with PHP, then maybe rather try working out why .htaccess doesn't work.


Messages In This Thread
How do I cache my images? I put $this->output->cache(100) but it is not working - by El Forum - 04-08-2011, 12:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB