diff options
author | Cash Costello <cash.costello@gmail.com> | 2009-10-03 19:26:12 +0000 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2009-10-03 19:26:12 +0000 |
commit | 9b3cba566de0bc5740e48f3f50eb8b09ffad49dc (patch) | |
tree | 13d8925fb44ef24782a6a211642637ee43431e89 /thumbnail.php | |
parent | a587ad4ed1867743ea9e698f98a156f4f763e86a (diff) | |
download | elgg-9b3cba566de0bc5740e48f3f50eb8b09ffad49dc.tar.gz elgg-9b3cba566de0bc5740e48f3f50eb8b09ffad49dc.tar.bz2 |
allowing browser to cache photos now
Diffstat (limited to 'thumbnail.php')
-rw-r--r-- | thumbnail.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/thumbnail.php b/thumbnail.php index eaca0849f..f310aee95 100644 --- a/thumbnail.php +++ b/thumbnail.php @@ -60,10 +60,19 @@ if (!$contents) {
forward('mod/tidypics/graphics/' . $error_image);
}
+
+ // expires every 14 days
+ $expires = 14 * 60*60*24;
- // Return the thumbnail and exit
+ // overwrite header caused by php session code so images can be cached
$mime = $file->getMimeType();
- header("Content-type: $mime");
+ header("Content-Type: $mime");
+ header("Content-Length: " . strlen($contents));
+ header("Cache-Control: public", true);
+ header("Pragma: public", true);
+ header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT', true);
+
+ // Return the thumbnail and exit
echo $contents;
exit;
?>
|