diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-07-13 16:21:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-13 16:21:36 +0200 |
commit | 7a5768e2594337fc613e5d0440a1857f64390ed2 (patch) | |
tree | fd0fd0b31c4b67828355653369b81dc4b1e5de5c | |
parent | c7f8085cc215ba48105c65d70103780d6f518568 (diff) | |
parent | 37c8ed4b5c9ca87a8c549716007a06d9e277040a (diff) | |
download | nextcloud-server-7a5768e2594337fc613e5d0440a1857f64390ed2.tar.gz nextcloud-server-7a5768e2594337fc613e5d0440a1857f64390ed2.zip |
Merge pull request #10198 from tml1024/master
No need to convert to PDF with LibreOffice, just convert to PNG
-rw-r--r-- | lib/private/Preview/Office.php | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/private/Preview/Office.php b/lib/private/Preview/Office.php index 955ab249df2..4a2aa7f4953 100644 --- a/lib/private/Preview/Office.php +++ b/lib/private/Preview/Office.php @@ -43,24 +43,24 @@ abstract class Office extends Provider { $tmpDir = \OC::$server->getTempManager()->getTempBaseDir(); - $defaultParameters = ' -env:UserInstallation=file://' . escapeshellarg($tmpDir . '/owncloud-' . \OC_Util::getInstanceId() . '/') . ' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to pdf --outdir '; + $defaultParameters = ' -env:UserInstallation=file://' . escapeshellarg($tmpDir . '/owncloud-' . \OC_Util::getInstanceId() . '/') . ' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to png --outdir '; $clParameters = \OC::$server->getConfig()->getSystemValue('preview_office_cl_parameters', $defaultParameters); $exec = $this->cmd . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath); shell_exec($exec); - //create imagick object from pdf - $pdfPreview = null; + //create imagick object from png + $pngPreview = null; try { list($dirname, , , $filename) = array_values(pathinfo($absPath)); - $pdfPreview = $dirname . '/' . $filename . '.pdf'; + $pngPreview = $dirname . '/' . $filename . '.png'; - $pdf = new \imagick($pdfPreview . '[0]'); - $pdf->setImageFormat('jpg'); + $png = new \imagick($pngPreview . '[0]'); + $png->setImageFormat('jpg'); } catch (\Exception $e) { unlink($absPath); - unlink($pdfPreview); + unlink($pngPreview); \OC::$server->getLogger()->logException($e, [ 'level' => ILogger::ERROR, 'app' => 'core', @@ -69,10 +69,10 @@ abstract class Office extends Provider { } $image = new \OC_Image(); - $image->loadFromData($pdf); + $image->loadFromData($png); unlink($absPath); - unlink($pdfPreview); + unlink($pngPreview); if ($image->valid()) { $image->scaleDownToFit($maxX, $maxY); |