check if imagick is loaded in office.php, not in libreoffice-cl.php

This commit is contained in:
Georg Ehrke 2013-06-11 11:00:44 +02:00
parent 2ff97917e9
commit 28cf63d37d
2 changed files with 54 additions and 56 deletions

View File

@ -8,8 +8,6 @@
namespace OC\Preview; namespace OC\Preview;
//we need imagick to convert //we need imagick to convert
if (extension_loaded('imagick')) {
class Office extends Provider { class Office extends Provider {
private $cmd; private $cmd;
@ -47,9 +45,7 @@ if (extension_loaded('imagick')) {
unlink($abspath); unlink($abspath);
unlink($abspath . '.pdf'); unlink($abspath . '.pdf');
if (!$image->valid()) return false; return $image->valid() ? $image : false;
return $image;
} }
private function initCmd() { private function initCmd() {
@ -74,7 +70,6 @@ if (extension_loaded('imagick')) {
$this->cmd = $cmd; $this->cmd = $cmd;
} }
} }
}
//.doc, .dot //.doc, .dot
class MSOfficeDoc extends Office { class MSOfficeDoc extends Office {

View File

@ -5,6 +5,8 @@
* later. * later.
* See the COPYING-README file. * See the COPYING-README file.
*/ */
//both, libreoffice backend and php fallback, need imagick
if (extension_loaded('imagick')) {
//let's see if there is libreoffice or openoffice on this machine //let's see if there is libreoffice or openoffice on this machine
if(shell_exec('libreoffice --headless --version') || shell_exec('openoffice --headless --version') || is_string(\OC_Config::getValue('preview_libreoffice_path', null))) { if(shell_exec('libreoffice --headless --version') || shell_exec('openoffice --headless --version') || is_string(\OC_Config::getValue('preview_libreoffice_path', null))) {
require_once('libreoffice-cl.php'); require_once('libreoffice-cl.php');
@ -13,3 +15,4 @@ if(shell_exec('libreoffice --headless --version') || shell_exec('openoffice --he
require_once('msoffice.php'); require_once('msoffice.php');
require_once('opendocument.php'); require_once('opendocument.php');
} }
}