check if the imagick extension is loaded
This commit is contained in:
parent
005d8e9870
commit
707f52f1db
1 changed files with 22 additions and 18 deletions
|
@ -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');
|
||||
|
||||
//new image object
|
||||
$image = new \OC_Image($svg);
|
||||
//check if image object is valid
|
||||
if (!$image->valid()) return false;
|
||||
|
||||
return $image;
|
||||
}
|
||||
}
|
||||
|
||||
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');
|
||||
OC_Preview::registerProvider('OC_Preview_SVG');
|
||||
|
||||
//new image object
|
||||
$image = new \OC_Image($svg);
|
||||
//check if image object is valid
|
||||
if (!$image->valid()) return false;
|
||||
|
||||
return $image;
|
||||
}
|
||||
}
|
||||
|
||||
OC_Preview::registerProvider('OC_Preview_SVG');
|
||||
}
|
Loading…
Reference in a new issue