Passing Image Requests thru PHP
| From: | [ rswfire ] | Date: | Wed, 08 May 2002 22:10:50 +0000 |
| Subject: | Passing Image Requests thru PHP | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-96691@lists.php.net to get a copy of this message | ||
I have my website set up so that all image requests are passed through PHP. If someone were to access the link: www.mydomain.com/images/image.jpeg, since the file does not really exist my root index.php file is called using Apache Redirect Rules. My reason for doing so may not be readily apparent, but it is a fine solution for what I need it for. The index.php file simply does the following when an image request is received. My problem is that these images are not being cached on the client computer, causing it to recall this image each time. Could someone inform me on what my Header() statement should be to ask it to cache these images? Thank you.
Header("Content-Type: image/jpeg");
Header("Cache-Control: cache-request-directive=only-if-cached, cache-response-directive=public");
if (file_exists($name_of_real_file)) readfile($name_of_real_file, "r");
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx