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,6 +170,11 @@ class thumbnailGenerator extends BaseProcessor | ||
| 170 | $default->log->debug('Thumbnail Generator Plugin: PDF file does not exist, cannot generate a thumbnail'); | 170 | $default->log->debug('Thumbnail Generator Plugin: PDF file does not exist, cannot generate a thumbnail'); |
| 171 | return false; | 171 | return false; |
| 172 | } | 172 | } |
| 173 | + | ||
| 174 | + if (WINDOWS_OS) { | ||
| 175 | + $thumbnailfile = KT_DIR . $thumbnailfile; | ||
| 176 | + } | ||
| 177 | + | ||
| 173 | // if a previous version of the thumbnail exists - delete it | 178 | // if a previous version of the thumbnail exists - delete it |
| 174 | if (file_exists($thumbnailfile)) { | 179 | if (file_exists($thumbnailfile)) { |
| 175 | @unlink($thumbnailfile); | 180 | @unlink($thumbnailfile); |
| @@ -177,7 +182,10 @@ class thumbnailGenerator extends BaseProcessor | @@ -177,7 +182,10 @@ class thumbnailGenerator extends BaseProcessor | ||
| 177 | // do generation | 182 | // do generation |
| 178 | // if (extension_loaded('imagick')) { | 183 | // if (extension_loaded('imagick')) { |
| 179 | $pathConvert = (!empty($default->convertPath)) ? $default->convertPath : 'convert'; | 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 | return true; | 189 | return true; |
| 182 | //}else{ | 190 | //}else{ |
| 183 | //$default->log->debug('Thumbnail Generator Plugin: Imagemagick not installed, cannot generate a thumbnail'); | 191 | //$default->log->debug('Thumbnail Generator Plugin: Imagemagick not installed, cannot generate a thumbnail'); |
| @@ -212,6 +220,10 @@ class ThumbnailViewlet extends KTDocumentViewlet { | @@ -212,6 +220,10 @@ class ThumbnailViewlet extends KTDocumentViewlet { | ||
| 212 | global $default; | 220 | global $default; |
| 213 | $varDir = $default->internalVarDirectory; | 221 | $varDir = $default->internalVarDirectory; |
| 214 | $thumbnailfile = $varDir . '/thumbnails/'.$documentId.'.jpg'; | 222 | $thumbnailfile = $varDir . '/thumbnails/'.$documentId.'.jpg'; |
| 223 | + | ||
| 224 | + if (WINDOWS_OS) { | ||
| 225 | + $thumbnailfile = KT_DIR . $thumbnailfile; | ||
| 226 | + } | ||
| 215 | 227 | ||
| 216 | // if the thumbnail doesn't exist try to create it | 228 | // if the thumbnail doesn't exist try to create it |
| 217 | if (!file_exists($thumbnailfile)){ | 229 | if (!file_exists($thumbnailfile)){ |