diff options
author | Georg Ehrke <georg@ownCloud.com> | 2013-05-28 11:59:20 +0200 |
---|---|---|
committer | Georg Ehrke <georg@ownCloud.com> | 2013-05-28 11:59:20 +0200 |
commit | 55b00fe819079d78224989eee91d5886233738ab (patch) | |
tree | 2d66f0048b6f4e97c833772c02540cd742936dfa /lib/preview | |
parent | 738cc48a85f48f8dca2b42d5667d6662810a688b (diff) | |
download | nextcloud-server-55b00fe819079d78224989eee91d5886233738ab.tar.gz nextcloud-server-55b00fe819079d78224989eee91d5886233738ab.zip |
make pdf backend work with encryption
Diffstat (limited to 'lib/preview')
-rw-r--r-- | lib/preview/pdf.php | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/lib/preview/pdf.php b/lib/preview/pdf.php index bf1d8b2b3b5..de5263f91d8 100644 --- a/lib/preview/pdf.php +++ b/lib/preview/pdf.php @@ -5,24 +5,31 @@ * later. * See the COPYING-README file. */ -class OC_Preview_PDF extends OC_Preview_Provider{ +if (extension_loaded('imagick')){ - public function getMimeType(){ - return '/application\/pdf/'; - } + class OC_Preview_PDF extends OC_Preview_Provider{ + + public function getMimeType(){ + return '/application\/pdf/'; + } + + public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { + $tmppath = $fileview->toTmpFile($path); - public function getThumbnail($path, $maxX, $maxY, $scalingup,$fileview) { - //create imagick object from pdf - $pdf = new imagick($fileview->getLocalFile($path) . '[0]'); - $pdf->setImageFormat('jpg'); + //create imagick object from pdf + $pdf = new imagick($tmppath . '[0]'); + $pdf->setImageFormat('jpg'); - //new image object - $image = new \OC_Image($pdf); - //check if image object is valid - if (!$image->valid()) return false; + unlink($tmppath); - return $image; + //new image object + $image = new \OC_Image($pdf); + //check if image object is valid + if (!$image->valid()) return false; + + return $image; + } } -} -OC_Preview::registerProvider('OC_Preview_PDF');
\ No newline at end of file + OC_Preview::registerProvider('OC_Preview_PDF'); +} |