Commit f406cb27ae4641aa051d7199d77f46c32881a7f6
1 parent
0e7f1906
Add extra debug level logging to thumbnail plugin
Showing
1 changed file
with
22 additions
and
5 deletions
plugins/thumbnails/thumbnails.php
| @@ -194,9 +194,12 @@ class thumbnailGenerator extends BaseProcessor | @@ -194,9 +194,12 @@ class thumbnailGenerator extends BaseProcessor | ||
| 194 | $thumbnailfile = $thumbnaildir.DIRECTORY_SEPARATOR.$this->document->iId.'.jpg'; | 194 | $thumbnailfile = $thumbnaildir.DIRECTORY_SEPARATOR.$this->document->iId.'.jpg'; |
| 195 | //if thumbail dir does not exist, generate one and add an index file to block access | 195 | //if thumbail dir does not exist, generate one and add an index file to block access |
| 196 | if (!file_exists($thumbnaildir)) { | 196 | if (!file_exists($thumbnaildir)) { |
| 197 | - mkdir($thumbnaildir, 0755); | ||
| 198 | - touch($thumbnaildir.DIRECTORY_SEPARATOR.'index.html'); | ||
| 199 | - file_put_contents($thumbnaildir.DIRECTORY_SEPARATOR.'index.html', 'You do not have permission to access this directory.'); | 197 | + mkdir($thumbnaildir, 0755); |
| 198 | + } | ||
| 199 | + | ||
| 200 | + if (!file_exists($thumbnaildir.DIRECTORY_SEPARATOR.'index.html')) { | ||
| 201 | + touch($thumbnaildir.DIRECTORY_SEPARATOR.'index.html'); | ||
| 202 | + file_put_contents($thumbnaildir.DIRECTORY_SEPARATOR.'index.html', 'You do not have permission to access this directory.'); | ||
| 200 | } | 203 | } |
| 201 | 204 | ||
| 202 | // if there is no pdf that exists - hop out | 205 | // if there is no pdf that exists - hop out |
| @@ -219,8 +222,22 @@ class thumbnailGenerator extends BaseProcessor | @@ -219,8 +222,22 @@ class thumbnailGenerator extends BaseProcessor | ||
| 219 | else { | 222 | else { |
| 220 | $cmd = "{$pathConvert} {$srcFile}" . $pageNumber . " -resize 200x200 $thumbnailfile"; | 223 | $cmd = "{$pathConvert} {$srcFile}" . $pageNumber . " -resize 200x200 $thumbnailfile"; |
| 221 | } | 224 | } |
| 222 | - | ||
| 223 | - $result = KTUtil::pexec($cmd); | 225 | + |
| 226 | + $default->log->debug($cmd); | ||
| 227 | + | ||
| 228 | + $output = KTUtil::pexec($cmd); | ||
| 229 | + | ||
| 230 | + // Log the output | ||
| 231 | + if(isset($output['out'])){ | ||
| 232 | + $out = $output['out']; | ||
| 233 | + if(is_array($out)){ | ||
| 234 | + $out = array_pop($out); | ||
| 235 | + } | ||
| 236 | + if(strpos($out, 'ERROR') === 0){ | ||
| 237 | + $default->log->error('InstaView Plugin: error in creation of document thumbnail '.$this->document->iId.': '. $out); | ||
| 238 | + } | ||
| 239 | + } | ||
| 240 | + | ||
| 224 | return true; | 241 | return true; |
| 225 | } | 242 | } |
| 226 | } | 243 | } |