$tmppath = $fileview->toTmpFile($path);
//create imagick object from pdf
- $pdf = new \imagick($tmppath . '[0]');
- $pdf->setImageFormat('jpg');
+ try{
+ $pdf = new \imagick($tmppath . '[0]');
+ $pdf->setImageFormat('jpg');
+ }catch(\Exception $e){
+ \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
+ return false;
+ }
unlink($tmppath);
}
public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) {
- $svg = new \Imagick();
- $svg->setResolution($maxX, $maxY);
-
- $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;
+ try{
+ $svg = new \Imagick();
+ $svg->setResolution($maxX, $maxY);
+
+ $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');
+ }catch(\Exception $e){
+ \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
+ return false;
}
- $svg->readImageBlob($content);
- $svg->setImageFormat('jpg');
-
//new image object
$image = new \OC_Image($svg);
//check if image object is valid