Shoutbox

[PHP] How to cache base64 decoded images? - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: [PHP] How to cache base64 decoded images? (/showthread.php?tid=31134)

[PHP] How to cache base64 decoded images? by KeyStorm on 09-08-2004 at 02:01 PM

I'm using base64_decode() for outputting images in KSMAS. I'm using now a rather big image in the header and I'd like to let it be cached by the browser, but I don't have a clue on how to do that.

I'm using he central script (index.php) to output images when it has an argument 'img' passed through GET. (like index.php?img=head)

The question is how to cache only certain outputs? :^)


RE: [PHP] How to cache base64 decoded images? by WDZ on 09-08-2004 at 02:11 PM

Send headers that tell the browser to cache it, and only send them with stuff you want cached? I'm not sure if it will work, but worth a try... :p

code:
// date in the past
header("Last-Modified: Tue, 01 Jul 2003 00:00:00 GMT");
// date in the future
header("Expires: ".gmdate("D, d M Y H:i:s", time() + 86400)." GMT");

As long as the URL stays the same (like index.php?img=head) I think it will work... :^)
RE: [PHP] How to cache base64 decoded images? by KeyStorm on 09-08-2004 at 03:31 PM

Nice, it worked, thanks!

I didn't think this would work very well with parametric URLs as it usually causes browsers to avoid caching it :S

Anyway, I'm happy to know this works :D