diff options
Diffstat (limited to 'apps/theming/lib/IconBuilder.php')
-rw-r--r-- | apps/theming/lib/IconBuilder.php | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/apps/theming/lib/IconBuilder.php b/apps/theming/lib/IconBuilder.php index 83258341985..ad44dd7ed6c 100644 --- a/apps/theming/lib/IconBuilder.php +++ b/apps/theming/lib/IconBuilder.php @@ -55,14 +55,38 @@ class IconBuilder { * @return string|false image blob */ public function getFavicon($app) { + if (!$this->themingDefaults->shouldReplaceIcons()) { + return false; + } try { - $icon = $this->renderAppIcon($app, 32); + $favicon = new Imagick(); + $favicon->setFormat("ico"); + $icon = $this->renderAppIcon($app, 128); if ($icon === false) { return false; } $icon->setImageFormat("png32"); - $data = $icon->getImageBlob(); + + $clone = clone $icon; + $clone->scaleImage(16,0); + $favicon->addImage($clone); + + $clone = clone $icon; + $clone->scaleImage(32,0); + $favicon->addImage($clone); + + $clone = clone $icon; + $clone->scaleImage(64,0); + $favicon->addImage($clone); + + $clone = clone $icon; + $clone->scaleImage(128,0); + $favicon->addImage($clone); + + $data = $favicon->getImagesBlob(); + $favicon->destroy(); $icon->destroy(); + $clone->destroy(); return $data; } catch (\ImagickException $e) { return false; |