aboutsummaryrefslogtreecommitdiff
path: root/thumbnail.php
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2009-10-03 19:26:12 +0000
committerCash Costello <cash.costello@gmail.com>2009-10-03 19:26:12 +0000
commit9b3cba566de0bc5740e48f3f50eb8b09ffad49dc (patch)
tree13d8925fb44ef24782a6a211642637ee43431e89 /thumbnail.php
parenta587ad4ed1867743ea9e698f98a156f4f763e86a (diff)
downloadelgg-9b3cba566de0bc5740e48f3f50eb8b09ffad49dc.tar.gz
elgg-9b3cba566de0bc5740e48f3f50eb8b09ffad49dc.tar.bz2
allowing browser to cache photos now
Diffstat (limited to 'thumbnail.php')
-rw-r--r--thumbnail.php13
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;
?>