From d55ef442cd861d04b9ccfd4493aedf0c9a4164ff Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 4 Feb 2014 12:59:14 +0100 Subject: [PATCH] properly check if pdf and svg modules are installed --- lib/private/preview/office.php | 2 +- lib/private/preview/pdf.php | 2 +- lib/private/preview/svg.php | 2 +- lib/private/preview/unknown.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/private/preview/office.php b/lib/private/preview/office.php index 7a4826c76e..884b6e7dc9 100644 --- a/lib/private/preview/office.php +++ b/lib/private/preview/office.php @@ -6,7 +6,7 @@ * See the COPYING-README file. */ //both, libreoffice backend and php fallback, need imagick -if (extension_loaded('imagick')) { +if (extension_loaded('imagick') && count(\Imagick::queryFormats("PDF")) === 1) { $isShellExecEnabled = \OC_Helper::is_function_enabled('shell_exec'); // LibreOffice preview is currently not supported on Windows diff --git a/lib/private/preview/pdf.php b/lib/private/preview/pdf.php index cc974b6881..572b8788ac 100644 --- a/lib/private/preview/pdf.php +++ b/lib/private/preview/pdf.php @@ -7,7 +7,7 @@ */ namespace OC\Preview; -if (extension_loaded('imagick')) { +if (extension_loaded('imagick') && count(\Imagick::queryFormats("PDF")) === 1) { class PDF extends Provider { diff --git a/lib/private/preview/svg.php b/lib/private/preview/svg.php index b49e51720f..07a37e8f8c 100644 --- a/lib/private/preview/svg.php +++ b/lib/private/preview/svg.php @@ -7,7 +7,7 @@ */ namespace OC\Preview; -if (extension_loaded('imagick')) { +if (extension_loaded('imagick') && count(\Imagick::queryFormats("SVG")) === 1) { class SVG extends Provider { diff --git a/lib/private/preview/unknown.php b/lib/private/preview/unknown.php index 4747f9e25e..8145c82614 100644 --- a/lib/private/preview/unknown.php +++ b/lib/private/preview/unknown.php @@ -22,7 +22,7 @@ class Unknown extends Provider { $svgPath = substr_replace($path, 'svg', -3); - if (extension_loaded('imagick') && file_exists($svgPath)) { + if (extension_loaded('imagick') && file_exists($svgPath) && count(\Imagick::queryFormats("SVG")) === 1) { // http://www.php.net/manual/de/imagick.setresolution.php#85284 $svg = new \Imagick();