Commit 469fd983b8205c13225148928a70e4f176a0c8c1
1 parent
962fb1ea
Cleaned up thumbnailer code to remove references to php imagick
Committed by: Paul Barrett
Showing
1 changed file
with
15 additions
and
20 deletions
plugins/thumbnails/thumbnails.php
| ... | ... | @@ -147,10 +147,10 @@ class thumbnailGenerator extends BaseProcessor |
| 147 | 147 | $mimeType = KTMime::getMimeTypeName($mimeTypeId); |
| 148 | 148 | |
| 149 | 149 | // Get the pdf source file - if the document is a pdf then use the document as the source |
| 150 | - if($mimeType == 'application/pdf'){ | |
| 150 | + if($mimeType == 'application/pdf') { | |
| 151 | 151 | $pdfDir = $default->documentRoot; |
| 152 | 152 | $pdfFile = $pdfDir . DIRECTORY_SEPARATOR . $this->document->getStoragePath(); |
| 153 | - }else{ | |
| 153 | + } else { | |
| 154 | 154 | $pdfDir = $default->pdfDirectory; |
| 155 | 155 | $pdfFile = $pdfDir .DIRECTORY_SEPARATOR. $this->document->iId.'.pdf'; |
| 156 | 156 | } |
| ... | ... | @@ -175,28 +175,23 @@ class thumbnailGenerator extends BaseProcessor |
| 175 | 175 | $default->log->debug('Thumbnail Generator Plugin: PDF file does not exist, cannot generate a thumbnail'); |
| 176 | 176 | return false; |
| 177 | 177 | } |
| 178 | - // if a previous version of the thumbnail exists - delete it | |
| 178 | + | |
| 179 | + // if a previous version of the thumbnail exists - delete it | |
| 179 | 180 | if (file_exists($thumbnailfile)) { |
| 180 | 181 | @unlink($thumbnailfile); |
| 181 | 182 | } |
| 182 | 183 | // do generation |
| 183 | - // if (extension_loaded('imagick')) { | |
| 184 | - $pathConvert = (!empty($default->convertPath)) ? $default->convertPath : 'convert'; | |
| 185 | - // windows path may contain spaces | |
| 186 | - | |
| 187 | - if (stristr(PHP_OS,'WIN')) { | |
| 188 | - $cmd = "\"{$pathConvert}\" -size 200x200 \"{$pdfFile}[0]\" -resize 200x200 \"$thumbnailfile\""; | |
| 189 | - } | |
| 190 | - else { | |
| 191 | - $cmd = "{$pathConvert} -size 200x200 {$pdfFile}[0] -resize 200x200 $thumbnailfile"; | |
| 192 | - } | |
| 193 | - $result = KTUtil::pexec($cmd); | |
| 194 | - return true; | |
| 195 | - //}else{ | |
| 196 | - //$default->log->debug('Thumbnail Generator Plugin: Imagemagick not installed, cannot generate a thumbnail'); | |
| 197 | - // return false; | |
| 198 | - //} | |
| 199 | - | |
| 184 | + $pathConvert = (!empty($default->convertPath)) ? $default->convertPath : 'convert'; | |
| 185 | + // windows path may contain spaces | |
| 186 | + if (stristr(PHP_OS,'WIN')) { | |
| 187 | + $cmd = "\"{$pathConvert}\" -size 200x200 \"{$pdfFile}[0]\" -resize 200x200 \"$thumbnailfile\""; | |
| 188 | + } | |
| 189 | + else { | |
| 190 | + $cmd = "{$pathConvert} -size 200x200 {$pdfFile}[0] -resize 200x200 $thumbnailfile"; | |
| 191 | + } | |
| 192 | + | |
| 193 | + $result = KTUtil::pexec($cmd); | |
| 194 | + return true; | |
| 200 | 195 | } |
| 201 | 196 | } |
| 202 | 197 | ... | ... |