Add caching to the imageexport plugin
Since we now heavily use this endpoint for the contacts menu we better set proper caching on the images. Else this gets reload over and over again leading to slow loading menu and unneded bytes transfered. * cache for 1 hour by default * added ETag for validation Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
94c2f12226
commit
59e27f03b6
|
@ -86,6 +86,11 @@ class ImageExportPlugin extends ServerPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result = $this->getPhoto($node)) {
|
if ($result = $this->getPhoto($node)) {
|
||||||
|
// Allow caching
|
||||||
|
$response->setHeader('Cache-Control', 'private, max-age=3600, must-revalidate');
|
||||||
|
$response->setHeader('Etag', $node->getETag() );
|
||||||
|
$response->setHeader('Pragma', 'public');
|
||||||
|
|
||||||
$response->setHeader('Content-Type', $result['Content-Type']);
|
$response->setHeader('Content-Type', $result['Content-Type']);
|
||||||
$response->setHeader('Content-Disposition', 'attachment');
|
$response->setHeader('Content-Disposition', 'attachment');
|
||||||
$response->setStatus(200);
|
$response->setStatus(200);
|
||||||
|
|
Loading…
Reference in New Issue