mirror of
https://github.com/nextcloud/server.git
synced 2026-06-10 09:13:19 -04:00
Gallery: Use OC_Respone::enableCaching for (album)thumbnails
This commit is contained in:
parent
363fdc40b8
commit
e137020f67
2 changed files with 2 additions and 10 deletions
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue