From 734b8c26dbbd043366275f0e5a90fdd8aef9f915 Mon Sep 17 00:00:00 2001 From: Simon L Date: Wed, 14 Jun 2023 19:58:31 +0200 Subject: [PATCH] generate user themed favicon and touchicon Signed-off-by: Simon L --- apps/theming/lib/Controller/IconController.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/theming/lib/Controller/IconController.php b/apps/theming/lib/Controller/IconController.php index 08ee71ac660c5..1b16293a7f34c 100644 --- a/apps/theming/lib/Controller/IconController.php +++ b/apps/theming/lib/Controller/IconController.php @@ -120,14 +120,15 @@ public function getFavicon(string $app = 'core'): Response { } catch (NotFoundException $e) { } if ($iconFile === null && $this->imageManager->shouldReplaceIcons()) { + $color = $this->themingDefaults->getColorPrimary(); try { - $iconFile = $this->imageManager->getCachedImage('favIcon-' . $app); + $iconFile = $this->imageManager->getCachedImage('favIcon-' . $app . $color); } catch (NotFoundException $exception) { $icon = $this->iconBuilder->getFavicon($app); if ($icon === false || $icon === '') { return new NotFoundResponse(); } - $iconFile = $this->imageManager->setCachedImage('favIcon-' . $app, $icon); + $iconFile = $this->imageManager->setCachedImage('favIcon-' . $app . $color, $icon); } $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/x-icon']); } @@ -157,14 +158,15 @@ public function getTouchIcon(string $app = 'core'): Response { } catch (NotFoundException $e) { } if ($this->imageManager->shouldReplaceIcons()) { + $color = $this->themingDefaults->getColorPrimary(); try { - $iconFile = $this->imageManager->getCachedImage('touchIcon-' . $app); + $iconFile = $this->imageManager->getCachedImage('touchIcon-' . $app . $color); } catch (NotFoundException $exception) { $icon = $this->iconBuilder->getTouchIcon($app); if ($icon === false || $icon === '') { return new NotFoundResponse(); } - $iconFile = $this->imageManager->setCachedImage('touchIcon-' . $app, $icon); + $iconFile = $this->imageManager->setCachedImage('touchIcon-' . $app . $color, $icon); } $response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/png']); }