Caching PHP output
Posted: Thu May 25, 2006 5:22 am
Weirdan | Please use
note to self - Saw somewhere this creates a new process each time it is accessed, which is probably not good.
The script then retrieves the blob from the database, checks for a header type and displays the image.
No problem thus far, HOWEVER:
I am not able to cache the image.
Any ideas.
This is the header I currently have.
I have checked the firefox (and Opera) cache and nothing is listed.
Before I clear the cache in firefox I did see some of the 'files' with an expire date of 1970-01-01 13:00:00
Any thoughts?
Thanks for any help.
Weirdan | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I have created a web application to display images which have been stored in a mySQL blob.
To view the image I call the PHP script from within an HTML img tag.Code: Select all
<img src='viewImg.php?imID=2345.gif' alt='Please cache me' />The script then retrieves the blob from the database, checks for a header type and displays the image.
No problem thus far, HOWEVER:
I am not able to cache the image.
Any ideas.
This is the header I currently have.
Code: Select all
list($width, $height, $mimeType, $attr) = getimagesize($imgBlob);
header("Content-Type: ".image_type_to_mime_type($mimeType));
header("Last-Modified: Wed, 24 May 2006 01:01:00 GMT"); /* Yesterday */
header("Cache-Control: max-age=86400, must-revalidate");
echo $imgBlob;Before I clear the cache in firefox I did see some of the 'files' with an expire date of 1970-01-01 13:00:00
Any thoughts?
Thanks for any help.
Weirdan | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]