From 6c7ebb120485a95f500fc3c3a1c565872980b54f Mon Sep 17 00:00:00 2001 From: Julius Haertl Date: Tue, 16 Aug 2016 10:30:56 +0200 Subject: [PATCH] Theming: Add icon caching Signed-off-by: Julius Haertl --- apps/theming/lib/Controller/IconController.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/theming/lib/Controller/IconController.php b/apps/theming/lib/Controller/IconController.php index 6e51f10c4cc..bbfa73b29ca 100644 --- a/apps/theming/lib/Controller/IconController.php +++ b/apps/theming/lib/Controller/IconController.php @@ -97,7 +97,11 @@ class IconController extends Controller { $svg = file_get_contents($image); $color = $this->template->getMailHeaderColor(); $svg = $this->colorizeSvg($svg, $color); - return new DataDisplayResponse($svg, Http::STATUS_OK, ['Content-Type' => 'image/svg+xml']); + + $response = new DataDisplayResponse($svg, Http::STATUS_OK, ['Content-Type' => 'image/svg+xml']); + $response->cacheFor(86400); + $response->addHeader('Expires', date(\DateTime::RFC2822, $this->timeFactory->getTime())); + return $response; } /** @@ -110,7 +114,6 @@ class IconController extends Controller { * @return StreamResponse|DataResponse */ public function getFavicon($app="core") { - // TODO: we need caching here $icon = $this->renderAppIcon($app); $icon->resizeImage(32, 32, Imagick::FILTER_LANCZOS, 1); $icon->setImageFormat("png24"); @@ -131,7 +134,6 @@ class IconController extends Controller { * @return StreamResponse|DataResponse */ public function getTouchIcon($app="core") { - // TODO: we need caching here $icon = $this->renderAppIcon($app); $icon->resizeImage(512, 512, Imagick::FILTER_LANCZOS, 1); $icon->setImageFormat("png24"); -- 2.39.5