Add a cache-control header for the images so that the browser caches the image for a day

This commit is contained in:
Lewis Dale 2023-08-26 19:15:54 +01:00
parent 6f23c71773
commit 967beadeb3

View File

@ -20,7 +20,9 @@ $params = new ResizeParams($_GET);
$resizer = new Resizer($imageDb, $logger); $resizer = new Resizer($imageDb, $logger);
try { try {
echo $resizer->performResize($imgPath, $params); $image = $resizer->performResize($imgPath, $params);
header("Cache-Control: max-age=86400, public");
echo $image;
} catch (\Exception $e) { } catch (\Exception $e) {
$logger->error($e->getMessage()); $logger->error($e->getMessage());
http_response_code(500); http_response_code(500);