summaryrefslogtreecommitdiffstats
path: root/apps/theming/lib
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2017-09-12 12:05:03 +0200
committerJulius Härtl <jus@bitgrid.net>2017-11-13 10:18:47 +0100
commit31b9fc9eaca2e16d7baef3ef7e4dfc12ba0ea45e (patch)
treebaeb6e078ffed9a0ee5eb73f87156d82308d2651 /apps/theming/lib
parent8e61ad884738b7fe427c7e9c7451484a8ecfc0ac (diff)
downloadnextcloud-server-31b9fc9eaca2e16d7baef3ef7e4dfc12ba0ea45e.tar.gz
nextcloud-server-31b9fc9eaca2e16d7baef3ef7e4dfc12ba0ea45e.zip
Theming: Generate favicon sizes to avoid resizing issues done by the browser
fixes #5193 Signed-off-by: Julius Haertl <jus@bitgrid.net>
Diffstat (limited to 'apps/theming/lib')
-rw-r--r--apps/theming/lib/IconBuilder.php25
1 files changed, 23 insertions, 2 deletions
diff --git a/apps/theming/lib/IconBuilder.php b/apps/theming/lib/IconBuilder.php
index 83258341985..96697687373 100644
--- a/apps/theming/lib/IconBuilder.php
+++ b/apps/theming/lib/IconBuilder.php
@@ -56,13 +56,34 @@ class IconBuilder {
*/
public function getFavicon($app) {
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;