diff options
author | Julius Haertl <jus@bitgrid.net> | 2016-10-14 21:42:25 +0200 |
---|---|---|
committer | Julius Haertl <jus@bitgrid.net> | 2016-11-18 10:23:24 +0100 |
commit | 43097eabeea450fd23d5c07c3df92d63abeb3e24 (patch) | |
tree | 5628dbbbbf4e22a20f59abcd9f816ef263808a88 | |
parent | 2e8dd218157123cdb7f1741980e12dc22b95f320 (diff) | |
download | nextcloud-server-43097eabeea450fd23d5c07c3df92d63abeb3e24.tar.gz nextcloud-server-43097eabeea450fd23d5c07c3df92d63abeb3e24.zip |
Fix svg resizing and remove deprecated method call
Signed-off-by: Julius Haertl <jus@bitgrid.net>
-rw-r--r-- | apps/theming/lib/IconBuilder.php | 11 | ||||
-rw-r--r-- | apps/theming/lib/ThemingDefaults.php | 4 |
2 files changed, 11 insertions, 4 deletions
diff --git a/apps/theming/lib/IconBuilder.php b/apps/theming/lib/IconBuilder.php index fac8cad430b..3819a2be4cb 100644 --- a/apps/theming/lib/IconBuilder.php +++ b/apps/theming/lib/IconBuilder.php @@ -104,13 +104,20 @@ class IconBuilder { $res = $tmp->getImageResolution(); $tmp->destroy(); + if($x>$y) { + $max = $x; + } else { + $max = $y; + } + // convert svg to resized image $appIconFile = new Imagick(); - $resX = (int)(512 * $res['x'] / $x * 2.53); - $resY = (int)(512 * $res['y'] / $y * 2.53); + $resX = (int)(512 * $res['x'] / $max * 2.53); + $resY = (int)(512 * $res['y'] / $max * 2.53); $appIconFile->setResolution($resX, $resY); $appIconFile->setBackgroundColor(new ImagickPixel('transparent')); $appIconFile->readImageBlob($svg); + $appIconFile->scaleImage(512, 512, true); } else { $appIconFile = new Imagick(); $appIconFile->setBackgroundColor(new ImagickPixel('transparent')); diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php index e10870685a5..2c344172127 100644 --- a/apps/theming/lib/ThemingDefaults.php +++ b/apps/theming/lib/ThemingDefaults.php @@ -157,8 +157,8 @@ class ThemingDefaults extends \OC_Defaults { */ public function shouldReplaceIcons() { $cache = $this->cacheFactory->create('theming'); - if($cache->hasKey('shouldReplaceIcons')) { - return (bool)$cache->get('shouldReplaceIcons'); + if($value = $cache->get('shouldReplaceIcons')) { + return (bool)$value; } $value = false; if(extension_loaded('imagick')) { |