summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorOlivier Paroz <github@oparoz.com>2015-01-25 19:05:30 +0100
committerOlivier Paroz <github@oparoz.com>2015-03-19 16:09:09 +0100
commit60b1643f02a2588d90fa77346bc377f5c1db8fbe (patch)
tree5c3b720e89a1364352e5d744d9cdae33f814a61a /lib
parent8d6b2b886752f974ad4db61fda8a38df9b5bf009 (diff)
downloadnextcloud-server-60b1643f02a2588d90fa77346bc377f5c1db8fbe.tar.gz
nextcloud-server-60b1643f02a2588d90fa77346bc377f5c1db8fbe.zip
Fix the office class
The office converter already replaces the original extension with '.pdf', so we need to switch the extensions of the tmp file instead of appending '.pdf' to it
Diffstat (limited to 'lib')
-rw-r--r--lib/private/preview/office.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/private/preview/office.php b/lib/private/preview/office.php
index 5bd61bde3be..1f6d977ade4 100644
--- a/lib/private/preview/office.php
+++ b/lib/private/preview/office.php
@@ -31,12 +31,16 @@ abstract class Office extends Provider {
shell_exec($exec);
//create imagick object from pdf
+ $pdfPreview = null;
try{
- $pdf = new \imagick($absPath . '.pdf' . '[0]');
+ list( $dirname, , , $filename ) = array_values( pathinfo($absPath) );
+ $pdfPreview = $dirname . '/' . $filename . '.pdf';
+
+ $pdf = new \imagick($pdfPreview . '[0]');
$pdf->setImageFormat('jpg');
} catch (\Exception $e) {
unlink($absPath);
- unlink($absPath . '.pdf');
+ unlink($pdfPreview);
\OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
return false;
}
@@ -45,7 +49,7 @@ abstract class Office extends Provider {
$image->loadFromData($pdf);
unlink($absPath);
- unlink($absPath . '.pdf');
+ unlink($pdfPreview);
return $image->valid() ? $image : false;
}