]> source.dussan.org Git - nextcloud-server.git/commitdiff
Gallery: Use OC_Respone::enableCaching for (album)thumbnails
authorBart Visscher <bartv@thisnet.nl>
Mon, 13 Feb 2012 21:38:34 +0000 (22:38 +0100)
committerBart Visscher <bartv@thisnet.nl>
Mon, 13 Feb 2012 21:38:34 +0000 (22:38 +0100)
apps/gallery/ajax/galleryOp.php
apps/gallery/ajax/thumbnail.php

index db6c79d6cdc2b4494ac16ec75004eef9a5c742f4..9273de2599d9827888a10e8a13747a55948cdae6 100644 (file)
@@ -40,13 +40,9 @@ function handleRemove($name) {
 }
 
 function handleGetThumbnails($albumname) {
+  OC_Response::enableCaching(3600 * 24); // 24 hour
   $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();
 }
 
index 2dfe936d9ddd03a54f9f1900e9974881e58d5d7f..184171f8fcadaad7eb5400aa575b6bf79fddd9bf 100644 (file)
@@ -29,10 +29,6 @@ $img = $_GET['img'];
 
 $image = OC_Gallery_Photo::getThumbnail($img);
 if ($image) {
-       $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');
+       OC_Response::enableCaching(3600 * 24); // 24 hour
        $image->show();
 }