From e137020f67f97bb04e59c04205e1815229d95fae Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Mon, 13 Feb 2012 22:38:34 +0100 Subject: [PATCH] Gallery: Use OC_Respone::enableCaching for (album)thumbnails --- apps/gallery/ajax/galleryOp.php | 6 +----- apps/gallery/ajax/thumbnail.php | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/apps/gallery/ajax/galleryOp.php b/apps/gallery/ajax/galleryOp.php index db6c79d6cdc..9273de2599d 100644 --- a/apps/gallery/ajax/galleryOp.php +++ b/apps/gallery/ajax/galleryOp.php @@ -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(); } diff --git a/apps/gallery/ajax/thumbnail.php b/apps/gallery/ajax/thumbnail.php index 2dfe936d9dd..184171f8fca 100644 --- a/apps/gallery/ajax/thumbnail.php +++ b/apps/gallery/ajax/thumbnail.php @@ -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(); } -- 2.39.5