Welcome Guest, Not a member yet? Register   Sign In
Caching image output
#1

[eluser]taviroquai[/eluser]

Hello,

Looking at http://ellislab.com/codeigniter/user-gui...ching.html it only says about web page cache.

Will $this->output->cache(n); also work for any content type like images or JSON ?

I'm trying but on firebug I only see response headers text/html...

Am I missing something?

BTW, what is the right approach to cache image output?

Cheers,
Marco Afonso
#2

[eluser]CroNiX[/eluser]
Image caching is done in the browser.

CI's caching caches the raw HTML or whatever is the output for that URL. Basically it takes what is the normal output for that page and writes it to the filesystem so that CI doesn't have to do any processing. It just loads the cached file if it exists and hasn't expired, and if not it generates the page and caches the results for the next request. So it will cache the <img> tags and whatnot, but your browser is the one to cache the actual image file once it receives it.
#3

[eluser]taviroquai[/eluser]

Hmm... That also applies to generated images by PHP? Because in my application, I will have a lot of requests to images generated by PHP.

This is an example of a request:
http://server/map/demo?LAYERS=layer1&TRA...HEIGHT=288

I tried using just $this->output->cache(n) but somehow CodeIgniter was outputing the same image for different requests (ie. different BBOX values). Also i looked at cache folder and there was only one file - maybe that explains the same image all over the map.

Any idea?

Thanks




Theme © iAndrew 2016 - Forum software by © MyBB