From 7cd1a302d36259ef8496ea59d7060c99b6d10e25 Mon Sep 17 00:00:00 2001
From: Bart Visscher <bartv@thisnet.nl>
Date: Wed, 8 Feb 2012 21:11:45 +0100
Subject: [PATCH] Gallery: Add caching headers to album thumbnail sending

---
 apps/gallery/ajax/galleryOp.php | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/apps/gallery/ajax/galleryOp.php b/apps/gallery/ajax/galleryOp.php
index 0ec447d01f..8df692c773 100644
--- a/apps/gallery/ajax/galleryOp.php
+++ b/apps/gallery/ajax/galleryOp.php
@@ -45,6 +45,11 @@ function handleGetThumbnails($albumname) {
   OC_JSON::checkLoggedIn();
   $photo = new OC_Image();
   $photo->loadFromFile(OC::$CONFIG_DATADIRECTORY.'/../gallery/'.$albumname.'.png');
+  $offset = 3600 * 24; // 24 hour
+  // calc the string in GMT not localtime and add the offset
+  header("Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT");
+  header('Cache-Control: max-age='.$offset.', must-revalidate');
+  header('Pragma: public');
   $photo->show();
 }
 
-- 
GitLab