diff options
author | Georg Ehrke <georg@ownCloud.com> | 2013-05-28 10:23:40 +0200 |
---|---|---|
committer | Georg Ehrke <georg@ownCloud.com> | 2013-05-28 10:23:40 +0200 |
commit | 707f52f1dbb063595541331f94b3796f0f96ce9a (patch) | |
tree | 9f5055c8ad3fb53e17353e8a415caf8b4851c532 /lib/preview | |
parent | 005d8e98706fc98d8dc5aa4927bb3ab0e6b00ac2 (diff) | |
download | nextcloud-server-707f52f1dbb063595541331f94b3796f0f96ce9a.tar.gz nextcloud-server-707f52f1dbb063595541331f94b3796f0f96ce9a.zip |
check if the imagick extension is loaded
Diffstat (limited to 'lib/preview')
-rw-r--r-- | lib/preview/svg.php | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/lib/preview/svg.php b/lib/preview/svg.php index 8f4697dce04..415b7751c2b 100644 --- a/lib/preview/svg.php +++ b/lib/preview/svg.php @@ -5,25 +5,29 @@ * later. * See the COPYING-README file. */ -class OC_Preview_SVG extends OC_Preview_Provider{ +if (extension_loaded('imagick')){ - public function getMimeType(){ - return '/image\/svg\+xml/'; - } + class OC_Preview_SVG extends OC_Preview_Provider{ + + public function getMimeType(){ + return '/image\/svg\+xml/'; + } - public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) { - $svg = new Imagick(); - $svg->setResolution($maxX, $maxY); - $svg->readImageBlob('<?xml version="1.0" encoding="UTF-8" standalone="no"?>' . $fileview->file_get_contents($path)); - $svg->setImageFormat('jpg'); + public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) { + $svg = new Imagick(); + $svg->setResolution($maxX, $maxY); + $svg->readImageBlob('<?xml version="1.0" encoding="UTF-8" standalone="no"?>' . $fileview->file_get_contents($path)); + $svg->setImageFormat('jpg'); - //new image object - $image = new \OC_Image($svg); - //check if image object is valid - if (!$image->valid()) return false; + //new image object + $image = new \OC_Image($svg); + //check if image object is valid + if (!$image->valid()) return false; - return $image; + return $image; + } } -} -OC_Preview::registerProvider('OC_Preview_SVG');
\ No newline at end of file + OC_Preview::registerProvider('OC_Preview_SVG'); + +}
\ No newline at end of file |