Skip to content
Snippets Groups Projects
Commit 21cc4f69 authored by Georg Ehrke's avatar Georg Ehrke
Browse files

make libreoffice preview backend work :D

parent 5c1d4fc1
No related branches found
No related tags found
No related merge requests found
......@@ -26,11 +26,13 @@ if (extension_loaded('imagick')) {
$abspath = $fileview->toTmpFile($path);
chdir(get_temp_dir());
$tmpdir = get_temp_dir();
$exec = $this->cmd . ' --headless --nologo --nofirststartwizard --invisible --norestore -convert-to pdf -outdir ' . escapeshellarg($tmpdir) . ' ' . escapeshellarg($abspath);
$export = 'export HOME=/tmp';
shell_exec($export . "\n" . $exec);
$exec = $this->cmd . ' --headless -convert-to pdf ' . escapeshellarg($abspath);
exec($exec);
//create imagick object from pdf
try{
$pdf = new \imagick($abspath . '.pdf' . '[0]');
......@@ -43,7 +45,8 @@ if (extension_loaded('imagick')) {
$image = new \OC_Image($pdf);
unlink($abspath);
unlink($tmppath);
unlink($abspath . '.pdf');
if (!$image->valid()) return false;
return $image;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment