From f406cb27ae4641aa051d7199d77f46c32881a7f6 Mon Sep 17 00:00:00 2001 From: Paul Barrett Date: Wed, 20 Jan 2010 10:29:13 +0200 Subject: [PATCH] Add extra debug level logging to thumbnail plugin --- plugins/thumbnails/thumbnails.php | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/plugins/thumbnails/thumbnails.php b/plugins/thumbnails/thumbnails.php index 19d15a7..22b88fa 100755 --- a/plugins/thumbnails/thumbnails.php +++ b/plugins/thumbnails/thumbnails.php @@ -194,9 +194,12 @@ class thumbnailGenerator extends BaseProcessor $thumbnailfile = $thumbnaildir.DIRECTORY_SEPARATOR.$this->document->iId.'.jpg'; //if thumbail dir does not exist, generate one and add an index file to block access if (!file_exists($thumbnaildir)) { - mkdir($thumbnaildir, 0755); - touch($thumbnaildir.DIRECTORY_SEPARATOR.'index.html'); - file_put_contents($thumbnaildir.DIRECTORY_SEPARATOR.'index.html', 'You do not have permission to access this directory.'); + mkdir($thumbnaildir, 0755); + } + + if (!file_exists($thumbnaildir.DIRECTORY_SEPARATOR.'index.html')) { + touch($thumbnaildir.DIRECTORY_SEPARATOR.'index.html'); + file_put_contents($thumbnaildir.DIRECTORY_SEPARATOR.'index.html', 'You do not have permission to access this directory.'); } // if there is no pdf that exists - hop out @@ -219,8 +222,22 @@ class thumbnailGenerator extends BaseProcessor else { $cmd = "{$pathConvert} {$srcFile}" . $pageNumber . " -resize 200x200 $thumbnailfile"; } - - $result = KTUtil::pexec($cmd); + + $default->log->debug($cmd); + + $output = KTUtil::pexec($cmd); + + // Log the output + if(isset($output['out'])){ + $out = $output['out']; + if(is_array($out)){ + $out = array_pop($out); + } + if(strpos($out, 'ERROR') === 0){ + $default->log->error('InstaView Plugin: error in creation of document thumbnail '.$this->document->iId.': '. $out); + } + } + return true; } } -- libgit2 0.21.4