diff options
author | Georg Ehrke <georg@ownCloud.com> | 2013-05-29 12:33:24 +0200 |
---|---|---|
committer | Georg Ehrke <georg@ownCloud.com> | 2013-05-29 12:46:54 +0200 |
commit | fa6b96090abc341da4f9320af02ee75b29a204e6 (patch) | |
tree | d38c9ecc5c34204c6e7266ef71947ad5305c8b7b /lib/preview/svg.php | |
parent | eebc15dce0da88dff91dc5249938341cd50b8a85 (diff) | |
download | nextcloud-server-fa6b96090abc341da4f9320af02ee75b29a204e6.tar.gz nextcloud-server-fa6b96090abc341da4f9320af02ee75b29a204e6.zip |
move to OC namespace
Diffstat (limited to 'lib/preview/svg.php')
-rw-r--r-- | lib/preview/svg.php | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/preview/svg.php b/lib/preview/svg.php index 415b7751c2b..70be263189d 100644 --- a/lib/preview/svg.php +++ b/lib/preview/svg.php @@ -5,18 +5,26 @@ * later. * See the COPYING-README file. */ +namespace OC\Preview; + if (extension_loaded('imagick')){ - class OC_Preview_SVG extends OC_Preview_Provider{ + class SVG extends Provider{ public function getMimeType(){ return '/image\/svg\+xml/'; } public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) { - $svg = new Imagick(); + $svg = new \Imagick(); $svg->setResolution($maxX, $maxY); - $svg->readImageBlob('<?xml version="1.0" encoding="UTF-8" standalone="no"?>' . $fileview->file_get_contents($path)); + + $content = stream_get_contents($fileview->fopen($path, 'r')); + if(substr($content, 0, 5) !== '<?xml'){ + $content = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' . $content; + } + + $svg->readImageBlob($content); $svg->setImageFormat('jpg'); //new image object @@ -28,6 +36,6 @@ if (extension_loaded('imagick')){ } } - OC_Preview::registerProvider('OC_Preview_SVG'); + \OC\Preview::registerProvider('OC\Preview\SVG'); }
\ No newline at end of file |