Skip to content
Snippets Groups Projects
Commit 707f52f1 authored by Georg Ehrke's avatar Georg Ehrke
Browse files

check if the imagick extension is loaded

parent 005d8e98
Branches
No related tags found
No related merge requests found
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment