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

View File

@ -5,11 +5,14 @@
* later.
* See the COPYING-README file.
*/
//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))) {
//both, libreoffice backend and php fallback, need imagick
if (extension_loaded('imagick')) {
//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))) {
require_once('libreoffice-cl.php');
}else{
}else{
//in case there isn't, use our fallback
require_once('msoffice.php');
require_once('opendocument.php');
}
}