Commit 0bedf7063bd4c64b6d5cc425b930b2f104b34fad
Merge branch 'edge' of git@github.com:ktgit/knowledgetree into edge
Showing
2 changed files
with
30 additions
and
11 deletions
plugins/thumbnails/templates/thumbnail_viewlet.smarty
| ... | ... | @@ -13,14 +13,16 @@ |
| 13 | 13 | <div id="thumb_{/literal}{$documentId}{literal}" class="thumb"> |
| 14 | 14 | <a href='{$url}' rel="lightbox" title="{$title}"> |
| 15 | 15 | <img id="img{$documentId}" src="{$thumbnail}" {if $height}height="{$height}"{/if} class="lightbox_window"/> |
| 16 | + </a> | |
| 16 | 17 | </div> |
| 17 | 18 | {else} |
| 18 | - <a href='{$url}' target='_blank'> | |
| 19 | - <img src="{$thumbnail}" {if $height}height="{$height}"{/if}/> | |
| 20 | - {/if} | |
| 21 | - | |
| 22 | - {if $url} | |
| 23 | - </a> | |
| 19 | + {if $url} | |
| 20 | + <a href='{$url}' target='_blank'> | |
| 21 | + <img src="{$thumbnail}" {if $height}height="{$height}"{/if}/> | |
| 22 | + </a> | |
| 23 | + {else} | |
| 24 | + <img src="{$thumbnail}" {if $height}height="{$height}"{/if}/> | |
| 25 | + {/if} | |
| 24 | 26 | {/if} |
| 25 | 27 | </div> |
| 26 | 28 | </div> |
| 27 | 29 | \ No newline at end of file | ... | ... |
plugins/thumbnails/thumbnails.php
| ... | ... | @@ -194,9 +194,12 @@ class thumbnailGenerator extends BaseProcessor |
| 194 | 194 | $thumbnailfile = $thumbnaildir.DIRECTORY_SEPARATOR.$this->document->iId.'.jpg'; |
| 195 | 195 | //if thumbail dir does not exist, generate one and add an index file to block access |
| 196 | 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 | 205 | // if there is no pdf that exists - hop out |
| ... | ... | @@ -219,8 +222,22 @@ class thumbnailGenerator extends BaseProcessor |
| 219 | 222 | else { |
| 220 | 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 | 241 | return true; |
| 225 | 242 | } |
| 226 | 243 | } | ... | ... |