From 9b3cba566de0bc5740e48f3f50eb8b09ffad49dc Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 3 Oct 2009 19:26:12 +0000 Subject: allowing browser to cache photos now --- thumbnail.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'thumbnail.php') 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; ?> -- cgit v1.2.3