fix issue with Non-static method Imagick ../..; @ doesn't seem to work in this case

This commit is contained in:
Georg Ehrke 2014-03-05 15:53:12 +01:00
parent 37d22bf170
commit dbf83aada2
3 changed files with 80 additions and 62 deletions

View file

@ -6,7 +6,11 @@
* See the COPYING-README file.
*/
//both, libreoffice backend and php fallback, need imagick
if (extension_loaded('imagick') && count(@\Imagick::queryFormats("PDF")) === 1) {
if (extension_loaded('imagick')) {
$checkImagick = new Imagick();
if(count($checkImagick->queryFormats('PDF')) === 1) {
$isShellExecEnabled = \OC_Helper::is_function_enabled('shell_exec');
// LibreOffice preview is currently not supported on Windows
@ -27,3 +31,4 @@ if (extension_loaded('imagick') && count(@\Imagick::queryFormats("PDF")) === 1)
require_once('office-fallback.php');
}
}
}

View file

@ -7,7 +7,13 @@
*/
namespace OC\Preview;
if (extension_loaded('imagick') && count(@\Imagick::queryFormats("PDF")) === 1) {
use Imagick;
if (extension_loaded('imagick')) {
$checkImagick = new Imagick();
if(count($checkImagick->queryFormats('PDF')) === 1) {
class PDF extends Provider {
@ -20,7 +26,7 @@ if (extension_loaded('imagick') && count(@\Imagick::queryFormats("PDF")) === 1)
//create imagick object from pdf
try{
$pdf = new \imagick($tmpPath . '[0]');
$pdf = new Imagick($tmpPath . '[0]');
$pdf->setImageFormat('jpg');
} catch (\Exception $e) {
\OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
@ -38,3 +44,4 @@ if (extension_loaded('imagick') && count(@\Imagick::queryFormats("PDF")) === 1)
\OC\Preview::registerProvider('OC\Preview\PDF');
}
}

View file

@ -7,7 +7,13 @@
*/
namespace OC\Preview;
if (extension_loaded('imagick') && count(@\Imagick::queryFormats("SVG")) === 1) {
use Imagick;
if (extension_loaded('imagick')) {
$checkImagick = new Imagick();
if(count($checkImagick->queryFormats('SVG')) === 1) {
class SVG extends Provider {
@ -17,7 +23,7 @@ if (extension_loaded('imagick') && count(@\Imagick::queryFormats("SVG")) === 1)
public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) {
try{
$svg = new \Imagick();
$svg = new Imagick();
$svg->setBackgroundColor(new \ImagickPixel('transparent'));
$content = stream_get_contents($fileview->fopen($path, 'r'));
@ -42,5 +48,5 @@ if (extension_loaded('imagick') && count(@\Imagick::queryFormats("SVG")) === 1)
}
\OC\Preview::registerProvider('OC\Preview\SVG');
}
}