Help - Caching a mySQL blob displayed in PHP
Posted: Wed May 24, 2006 10:35 am
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.
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'm not sure if a php 'image' can be cached. Any thoughts?
Thanks for any help.
To view the image I call the PHP script from within an HTML img tag.
Code: Select all
<img src='view.php?imID=2345' alt='Please cache' />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: Sat, 01 Jan 2005 01:01:00 GMT"); /* updated from information by timvw */
header("Cache-Control: max-age=86400, must-revalidate");
echo $imgBlob;Thanks for any help.