summaryrefslogtreecommitdiffstats
path: root/lib/private/preview/unknown.php
diff options
context:
space:
mode:
authorGeorg Ehrke <developer@georgehrke.com>2013-09-23 09:45:36 +0200
committerMorris Jobke <morris.jobke@gmail.com>2013-10-07 13:19:20 +0200
commit4ac3ecace2a285b954967ebe7de8d7ef54c4b655 (patch)
tree20612ceae1df2fe1046c2abac81f6122382c7ebe /lib/private/preview/unknown.php
parent981608cf6b82daf6f8610ad0b5db319f663a02a7 (diff)
downloadnextcloud-server-4ac3ecace2a285b954967ebe7de8d7ef54c4b655.tar.gz
nextcloud-server-4ac3ecace2a285b954967ebe7de8d7ef54c4b655.zip
use svg to generate filetype icon if imagick available
Diffstat (limited to 'lib/private/preview/unknown.php')
-rw-r--r--lib/private/preview/unknown.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/private/preview/unknown.php b/lib/private/preview/unknown.php
index 9e6cd68d401..9c1d41bef5a 100644
--- a/lib/private/preview/unknown.php
+++ b/lib/private/preview/unknown.php
@@ -20,7 +20,22 @@ class Unknown extends Provider {
$path = \OC_Helper::mimetypeIcon($mimetype);
$path = \OC::$SERVERROOT . substr($path, strlen(\OC::$WEBROOT));
- return new \OC_Image($path);
+ if (extension_loaded('imagick')) {
+ $path = substr_replace($path, 'png', -3);
+ $content = file_get_contents($path);
+
+ $svg = new \Imagick();
+ $svg->setBackgroundColor(new \ImagickPixel('transparent'));
+ $svg->readImageBlob($content);
+ $svg->setImageFormat('png32');
+
+ $image = new \OC_Image();
+ $image->loadFromData($svg);
+ } else {
+ $image = new \OC_Image($path);
+ }
+
+ return $image;
}
}