diff options
-rw-r--r-- | apps/theming/lib/IconBuilder.php | 11 | ||||
-rw-r--r-- | apps/theming/tests/IconBuilderTest.php | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/apps/theming/lib/IconBuilder.php b/apps/theming/lib/IconBuilder.php index d8161051ebb..570b3411049 100644 --- a/apps/theming/lib/IconBuilder.php +++ b/apps/theming/lib/IconBuilder.php @@ -52,11 +52,10 @@ class IconBuilder { * @return string|false image blob */ public function getFavicon($app) { - $icon = $this->renderAppIcon($app); + $icon = $this->renderAppIcon($app, 32); if($icon === false) { return false; } - $icon->resizeImage(32, 32, Imagick::FILTER_LANCZOS, 1); $icon->setImageFormat("png24"); $data = $icon->getImageBlob(); $icon->destroy(); @@ -68,7 +67,7 @@ class IconBuilder { * @return string|false image blob */ public function getTouchIcon($app) { - $icon = $this->renderAppIcon($app); + $icon = $this->renderAppIcon($app, 512); if($icon === false) { return false; } @@ -83,9 +82,10 @@ class IconBuilder { * fallback to logo * * @param $app string app name + * @param $size int size of the icon in px * @return Imagick|false */ - public function renderAppIcon($app) { + public function renderAppIcon($app, $size) { try { $appIcon = $this->util->getAppIcon($app); $appIconContent = file_get_contents($appIcon); @@ -157,7 +157,8 @@ class IconBuilder { $finalIconFile->setImageVirtualPixelMethod(Imagick::VIRTUALPIXELMETHOD_TRANSPARENT); $finalIconFile->setImageArtifact('compose:args', "1,0,-0.5,0.5"); $finalIconFile->compositeImage($appIconFile, Imagick::COMPOSITE_ATOP, $offset_w, $offset_h); - $finalIconFile->resizeImage(512, 512, Imagick::FILTER_LANCZOS, 1); + $finalIconFile->setImageFormat('png24'); + $finalIconFile->resizeImage($size, $size, Imagick::INTERPOLATE_BICUBIC, 1, false); $appIconFile->destroy(); return $finalIconFile; diff --git a/apps/theming/tests/IconBuilderTest.php b/apps/theming/tests/IconBuilderTest.php index 54850c8f3c2..da27795ce2c 100644 --- a/apps/theming/tests/IconBuilderTest.php +++ b/apps/theming/tests/IconBuilderTest.php @@ -91,7 +91,7 @@ class IconBuilderTest extends TestCase { ->willReturn($color); $expectedIcon = new \Imagick(realpath(dirname(__FILE__)). "/data/" . $file); - $icon = $this->iconBuilder->renderAppIcon($app); + $icon = $this->iconBuilder->renderAppIcon($app, 512); $this->assertEquals(true, $icon->valid()); $this->assertEquals(512, $icon->getImageWidth()); |