diff options
-rw-r--r-- | lib/private/preview/office.php | 10 |
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; } |