From 3bd7784c1e2622f6dff11d7432ff5071bbff3d84 Mon Sep 17 00:00:00 2001 From: SebastianKrupinski Date: Mon, 23 Feb 2026 10:33:43 -0500 Subject: [PATCH] fix(theming): Fix favicon and touchicon ratios Signed-off-by: SebastianKrupinski --- apps/theming/lib/IconBuilder.php | 5 ++--- apps/theming/tests/IconBuilderTest.php | 6 ++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/apps/theming/lib/IconBuilder.php b/apps/theming/lib/IconBuilder.php index b745815ae9bdf..775731799d82d 100644 --- a/apps/theming/lib/IconBuilder.php +++ b/apps/theming/lib/IconBuilder.php @@ -144,9 +144,8 @@ public function renderAppIcon($app, $size) { $y = $tmp->getImageHeight(); $tmp->destroy(); // set resolution for proper scaling - $resX = (int)(72 * $size / $x); - $resY = (int)(72 * $size / $y); - $appIconFile->setResolution($resX, $resY); + $res = (int)(72 * $size / max($x, $y)); + $appIconFile->setResolution($res, $res); $appIconFile->readImageBlob($svg); } else { // handle non-SVG images diff --git a/apps/theming/tests/IconBuilderTest.php b/apps/theming/tests/IconBuilderTest.php index ee7103691b5de..3bfa4ee050c5c 100644 --- a/apps/theming/tests/IconBuilderTest.php +++ b/apps/theming/tests/IconBuilderTest.php @@ -297,11 +297,9 @@ private function generateTestIcon(string $file, string $format, int $size, strin $x = $tmp->getImageWidth(); $y = $tmp->getImageHeight(); $tmp->destroy(); - // set resolution for proper scaling - $resX = (int)(72 * $size / $x); - $resY = (int)(72 * $size / $y); + $res = (int)(72 * $size / max($x, $y)); $appIconFile->setBackgroundColor(new \ImagickPixel('transparent')); - $appIconFile->setResolution($resX, $resY); + $appIconFile->setResolution($res, $res); $appIconFile->readImageBlob($svgContent); } else { $appIconFile->readImage($filePath);