nextcloud/lib/preview/pdf.php

28 lines
709 B
PHP
Raw Normal View History

2013-05-10 01:59:16 +04:00
<?php
/**
2013-05-17 14:00:32 +04:00
* Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
2013-05-10 01:59:16 +04:00
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
class OC_Preview_PDF extends OC_Preview_Provider{
public function getMimeType(){
return '/application\/pdf/';
}
public function getThumbnail($path, $maxX, $maxY, $scalingup,$fileview) {
//create imagick object from pdf
$pdf = new imagick($fileview->getLocalFile($path) . '[0]');
2013-05-17 11:43:25 +04:00
$pdf->setImageFormat('jpg');
2013-05-10 01:59:16 +04:00
//new image object
2013-05-17 11:43:25 +04:00
$image = new \OC_Image($pdf);
2013-05-10 01:59:16 +04:00
//check if image object is valid
if (!$image->valid()) return false;
return $image;
}
}
OC_Preview::registerProvider('OC_Preview_PDF');