Fix svg resizing and remove deprecated method call
Signed-off-by: Julius Haertl <jus@bitgrid.net>
This commit is contained in:
parent
2e8dd21815
commit
43097eabee
|
@ -104,13 +104,20 @@ class IconBuilder {
|
||||||
$res = $tmp->getImageResolution();
|
$res = $tmp->getImageResolution();
|
||||||
$tmp->destroy();
|
$tmp->destroy();
|
||||||
|
|
||||||
|
if($x>$y) {
|
||||||
|
$max = $x;
|
||||||
|
} else {
|
||||||
|
$max = $y;
|
||||||
|
}
|
||||||
|
|
||||||
// convert svg to resized image
|
// convert svg to resized image
|
||||||
$appIconFile = new Imagick();
|
$appIconFile = new Imagick();
|
||||||
$resX = (int)(512 * $res['x'] / $x * 2.53);
|
$resX = (int)(512 * $res['x'] / $max * 2.53);
|
||||||
$resY = (int)(512 * $res['y'] / $y * 2.53);
|
$resY = (int)(512 * $res['y'] / $max * 2.53);
|
||||||
$appIconFile->setResolution($resX, $resY);
|
$appIconFile->setResolution($resX, $resY);
|
||||||
$appIconFile->setBackgroundColor(new ImagickPixel('transparent'));
|
$appIconFile->setBackgroundColor(new ImagickPixel('transparent'));
|
||||||
$appIconFile->readImageBlob($svg);
|
$appIconFile->readImageBlob($svg);
|
||||||
|
$appIconFile->scaleImage(512, 512, true);
|
||||||
} else {
|
} else {
|
||||||
$appIconFile = new Imagick();
|
$appIconFile = new Imagick();
|
||||||
$appIconFile->setBackgroundColor(new ImagickPixel('transparent'));
|
$appIconFile->setBackgroundColor(new ImagickPixel('transparent'));
|
||||||
|
|
|
@ -157,8 +157,8 @@ class ThemingDefaults extends \OC_Defaults {
|
||||||
*/
|
*/
|
||||||
public function shouldReplaceIcons() {
|
public function shouldReplaceIcons() {
|
||||||
$cache = $this->cacheFactory->create('theming');
|
$cache = $this->cacheFactory->create('theming');
|
||||||
if($cache->hasKey('shouldReplaceIcons')) {
|
if($value = $cache->get('shouldReplaceIcons')) {
|
||||||
return (bool)$cache->get('shouldReplaceIcons');
|
return (bool)$value;
|
||||||
}
|
}
|
||||||
$value = false;
|
$value = false;
|
||||||
if(extension_loaded('imagick')) {
|
if(extension_loaded('imagick')) {
|
||||||
|
|
Loading…
Reference in New Issue