Commit 53042bc76a19ce05e454b815f50fa6cd149b3948
1 parent
b4131270
Reinstated KTUtil pexec instead of shell_exec and escaped Windows path to convert.exe
Committed by: Paul Barrett
Showing
1 changed file
with
13 additions
and
1 deletions
plugins/thumbnails/thumbnails.php
| ... | ... | @@ -170,6 +170,11 @@ class thumbnailGenerator extends BaseProcessor |
| 170 | 170 | $default->log->debug('Thumbnail Generator Plugin: PDF file does not exist, cannot generate a thumbnail'); |
| 171 | 171 | return false; |
| 172 | 172 | } |
| 173 | + | |
| 174 | + if (WINDOWS_OS) { | |
| 175 | + $thumbnailfile = KT_DIR . $thumbnailfile; | |
| 176 | + } | |
| 177 | + | |
| 173 | 178 | // if a previous version of the thumbnail exists - delete it |
| 174 | 179 | if (file_exists($thumbnailfile)) { |
| 175 | 180 | @unlink($thumbnailfile); |
| ... | ... | @@ -177,7 +182,10 @@ class thumbnailGenerator extends BaseProcessor |
| 177 | 182 | // do generation |
| 178 | 183 | // if (extension_loaded('imagick')) { |
| 179 | 184 | $pathConvert = (!empty($default->convertPath)) ? $default->convertPath : 'convert'; |
| 180 | - $result = shell_exec("{$pathConvert} -size 200x200 {$pdfFile}[0] -resize 200x200 $thumbnailfile"); | |
| 185 | + if (WINDOWS_OS) { | |
| 186 | + $pathConvert = '"' . $pathConvert . '"'; | |
| 187 | + } | |
| 188 | + $result = KTUtil::pexec("{$pathConvert} -size 200x200 {$pdfFile}[0] -resize 200x200 $thumbnailfile"); | |
| 181 | 189 | return true; |
| 182 | 190 | //}else{ |
| 183 | 191 | //$default->log->debug('Thumbnail Generator Plugin: Imagemagick not installed, cannot generate a thumbnail'); |
| ... | ... | @@ -212,6 +220,10 @@ class ThumbnailViewlet extends KTDocumentViewlet { |
| 212 | 220 | global $default; |
| 213 | 221 | $varDir = $default->internalVarDirectory; |
| 214 | 222 | $thumbnailfile = $varDir . '/thumbnails/'.$documentId.'.jpg'; |
| 223 | + | |
| 224 | + if (WINDOWS_OS) { | |
| 225 | + $thumbnailfile = KT_DIR . $thumbnailfile; | |
| 226 | + } | |
| 215 | 227 | |
| 216 | 228 | // if the thumbnail doesn't exist try to create it |
| 217 | 229 | if (!file_exists($thumbnailfile)){ | ... | ... |