diff --git a/plugins/ktcore/KTWidgets.php b/plugins/ktcore/KTWidgets.php index d074654..ac53e4c 100755 --- a/plugins/ktcore/KTWidgets.php +++ b/plugins/ktcore/KTWidgets.php @@ -1113,9 +1113,13 @@ class KTCoreImageWidget extends KTWidget { return $res; } - $this->src = $aOptions['src']; - $this->alt = $aOptions['alt']; - $this->title = $aOptions['title']; + $this->aOptions['src'] = KTUtil::arrayGet($aOptions, 'src', ''); + $this->aOptions['alt'] = KTUtil::arrayGet($aOptions, 'alt', ''); + $this->aOptions['title'] = KTUtil::arrayGet($aOptions, 'title', ''); + $this->aOptions['width'] = KTUtil::arrayGet($aOptions, 'width', ''); + $this->aOptions['height'] = KTUtil::arrayGet($aOptions, 'height', ''); + $this->aOptions['has_width'] = ($this->aOptions['height'] !== null); + $this->aOptions['has_height'] = ($this->aOptions['height'] !== null); } @@ -1146,12 +1150,14 @@ class KTCoreImageSelectWidget extends KTWidget { var $sNamespace = 'ktcore.widgets.imageselect'; var $sTemplate = 'ktcore/forms/widgets/imageselect'; + var $width; + var $height; + function configure($aOptions) { $res = parent::configure($aOptions); if (PEAR::isError($res)) { return $res; } - } function render() { diff --git a/plugins/ktcore/admin/deletedDocuments.php b/plugins/ktcore/admin/deletedDocuments.php index bd4fe61..6cd8d10 100755 --- a/plugins/ktcore/admin/deletedDocuments.php +++ b/plugins/ktcore/admin/deletedDocuments.php @@ -5,32 +5,32 @@ * KnowledgeTree Community Edition * Document Management Made Simple * Copyright (C) 2008, 2009 KnowledgeTree Inc. - * - * + * + * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License version 3 as published by the * Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, + * + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, * California 94120-7775, or email info@knowledgetree.com. - * + * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU General Public License version 3. - * + * * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by - * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * KnowledgeTree" logo and retain the original copyright notice. If the display of the * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices - * must display the words "Powered by KnowledgeTree" and retain the original + * must display the words "Powered by KnowledgeTree" and retain the original * copyright notice. * Contributor( s): ______________________________________ * @@ -51,9 +51,9 @@ class DeletedDocumentsDispatcher extends KTAdminDispatcher { var $sHelpPage = 'ktcore/admin/deleted documents.html'; function do_main () { $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Deleted Documents')); - + $this->oPage->setBreadcrumbDetails(_kt('view')); - + $aDocuments =& Document::getList('status_id=' . DELETED); if(!empty($aDocuments)){ @@ -72,12 +72,12 @@ var $sHelpPage = 'ktcore/admin/deleted documents.html'; }else{ $limit = 9; } - + for($i = 0; $i <= $limit; $i++){ $aDocumentsList[] = $aDocuments[$i]; } } - + $oTemplating =& KTTemplating::getSingleton(); $oTemplate = $oTemplating->loadTemplate('ktcore/document/admin/deletedlist'); $oTemplate->setData(array( @@ -90,7 +90,7 @@ var $sHelpPage = 'ktcore/admin/deleted documents.html'; )); return $oTemplate; } - + function do_branchConfirm() { $submit = KTUtil::arrayGet($_REQUEST, 'submit' , array()); if (array_key_exists('expunge',$submit)) { @@ -104,33 +104,33 @@ var $sHelpPage = 'ktcore/admin/deleted documents.html'; } $this->errorRedirectToMain(_kt('No action specified.')); } - + function do_confirm_expunge($all = false) { $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Deleted Documents')); - + $selected_docs = KTUtil::arrayGet($_REQUEST, 'selected_docs', array()); $full_docs = KTUtil::arrayGet($_REQUEST, 'docIds', array()); - + if($all == true){ $selected_docs = $full_docs; } - + $this->oPage->setTitle(sprintf(_kt('Confirm Expunge of %d documents'), count($selected_docs))); - + $this->oPage->setBreadcrumbDetails(sprintf(_kt('confirm expunge of %d documents'), count($selected_docs))); - + $aDocuments = array(); foreach ($selected_docs as $doc_id) { $oDoc =& Document::get($doc_id); - if (PEAR::isError($oDoc) || ($oDoc === false)) { + if (PEAR::isError($oDoc) || ($oDoc === false)) { $this->errorRedirectToMain(_kt('Invalid document id specified. Aborting expunge')); } else if ($oDoc->getStatusId() != DELETED) { $this->errorRedirectToMain(sprintf(_kt('%s is not a deleted document. Aborting expunge'), $oDoc->getName())); } $aDocuments[] = $oDoc; } - - + + $oTemplating =& KTTemplating::getSingleton(); $oTemplate = $oTemplating->loadTemplate('ktcore/document/admin/expungeconfirmlist'); $oTemplate->setData(array( @@ -140,47 +140,49 @@ var $sHelpPage = 'ktcore/admin/deleted documents.html'; return $oTemplate; } - function do_finish_expunge() { - $selected_docs = KTUtil::arrayGet($_REQUEST, 'selected_docs', array()); - + function do_finish_expunge() { + $selected_docs = KTUtil::arrayGet($_REQUEST, 'selected_docs', array()); + $aDocuments = array(); foreach ($selected_docs as $doc_id) { $oDoc =& Document::get($doc_id); - if (PEAR::isError($oDoc) || ($oDoc === false)) { + if (PEAR::isError($oDoc) || ($oDoc === false)) { $this->errorRedirectToMain(_kt('Invalid document id specified. Aborting expunge')); } else if ($oDoc->getStatusId() != DELETED) { $this->errorRedirectToMain(sprintf(_kt('%s is not a deleted document. Aborting expunge'), $oDoc->getName())); } $aDocuments[] = $oDoc; } - + $this->startTransaction(); $aErrorDocuments = array(); - $aSuccessDocuments = array(); + $aSuccessDocuments = array(); + $aDeletedDocs = array(); $oStorage =& KTStorageManagerUtil::getSingleton(); + $oKTTriggerRegistry = KTTriggerRegistry::getSingleton(); foreach ($aDocuments as $oDoc) { // first evaluate the folder for inconsistencies. $oFolder = Folder::get($oDoc->getFolderID()); if (PEAR::isError($oFolder)) { $oDoc->setFolderId(1); $oDoc->update(); } - + if (!$oStorage->expunge($oDoc)) { $aErrorDocuments[] = $oDoc->getDisplayPath(); } else { $oDocumentTransaction = & new DocumentTransaction($oDoc, _kt('Document expunged'), 'ktcore.transactions.expunge'); $oDocumentTransaction->create(); - + // delete this from the db now if (!$oDoc->delete()) { - $aErrorDocuments[] = $oDoc->getId(); + $aErrorDocuments[] = $oDoc->getId(); } else { // removed succesfully $aSuccessDocuments[] = $oDoc->getDisplayPath(); - + $aDeletedDocs[] = $oDoc->getId(); + // remove any document data $oDoc->cleanupDocumentData($oDoc->getId()); // silly - why the redundancy? - - $oKTTriggerRegistry = KTTriggerRegistry::getSingleton(); + $aTriggers = $oKTTriggerRegistry->getTriggers('expunge', 'finalised'); foreach ($aTriggers as $aTrigger) { $sTrigger = $aTrigger[0]; @@ -189,38 +191,50 @@ var $sHelpPage = 'ktcore/admin/deleted documents.html'; 'document' => $oDoc, ); $oTrigger->setInfo($aInfo); - $ret = $oTrigger->finalised(); + $ret = $oTrigger->finalised(); } } } } $this->commitTransaction(); + + $aTriggers = $oKTTriggerRegistry->getTriggers('expunge', 'postValidate'); + foreach ($aTriggers as $aTrigger) { + $sTrigger = $aTrigger[0]; + $oTrigger = new $sTrigger; + $aInfo = array( + 'documents' => $aDeletedDocs, + ); + $oTrigger->setInfo($aInfo); + $ret = $oTrigger->postValidate(); + } + $msg = sprintf(_kt('%d documents expunged.'), count($aSuccessDocuments)); if (count($aErrorDocuments) != 0) { $msg .= _kt('Failed to expunge') . ': ' . join(', ', $aErrorDocuments); } $this->successRedirectToMain($msg); } - + function do_confirm_restore() { $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Deleted Documents')); - - $selected_docs = KTUtil::arrayGet($_REQUEST, 'selected_docs', array()); - + + $selected_docs = KTUtil::arrayGet($_REQUEST, 'selected_docs', array()); + $this->oPage->setTitle(sprintf(_kt('Confirm Restore of %d documents'), count($selected_docs))); - + $this->oPage->setBreadcrumbDetails(sprintf(_kt('Confirm Restore of %d documents'), count($selected_docs))); - + $aDocuments = array(); foreach ($selected_docs as $doc_id) { $oDoc =& Document::get($doc_id); - if (PEAR::isError($oDoc) || ($oDoc === false)) { + if (PEAR::isError($oDoc) || ($oDoc === false)) { $this->errorRedirectToMain(_kt('Invalid document id specified. Aborting expunge')); } else if ($oDoc->getStatusId() != DELETED) { $this->errorRedirectToMain(sprintf(_kt('%s is not a deleted document. Aborting expunge'), $oDoc->getName())); } $aDocuments[] = $oDoc; } - - + + $oTemplating =& KTTemplating::getSingleton(); $oTemplate = $oTemplating->loadTemplate('ktcore/document/admin/restoreconfirmlist'); $oTemplate->setData(array( @@ -230,36 +244,36 @@ var $sHelpPage = 'ktcore/admin/deleted documents.html'; return $oTemplate; } - function do_finish_restore() { - $selected_docs = KTUtil::arrayGet($_REQUEST, 'selected_docs', array()); - + function do_finish_restore() { + $selected_docs = KTUtil::arrayGet($_REQUEST, 'selected_docs', array()); + $aDocuments = array(); foreach ($selected_docs as $doc_id) { $oDoc =& Document::get($doc_id); - if (PEAR::isError($oDoc) || ($oDoc === false)) { + if (PEAR::isError($oDoc) || ($oDoc === false)) { $this->errorRedirectToMain(_kt('Invalid document id specified. Aborting restore')); } else if ($oDoc->getStatusId() != DELETED) { $this->errorRedirectToMain(sprintf(_kt('%s is not a deleted document. Aborting restore'), $oDoc->getName())); } $aDocuments[] = $oDoc; } - + $this->startTransaction(); $aErrorDocuments = array(); - $aSuccessDocuments = array(); + $aSuccessDocuments = array(); $oStorage =& KTStorageManagerUtil::getSingleton(); foreach ($aDocuments as $oDoc) { $oFolder = Folder::get($oDoc->getRestoreFolderId()); // move to root if parent no longer exists. - if (PEAR::isError($oFolder)) { - $oDoc->setFolderId(1); + if (PEAR::isError($oFolder)) { + $oDoc->setFolderId(1); $oFolder = Folder::get(1); - } else { + } else { $oDoc->setFolderId($oDoc->getRestoreFolderId()); } - + if ($oStorage->restore($oDoc)) { $oDoc = Document::get($oDoc->getId()); // storage path has changed for most recent object... $oDoc->setStatusId(LIVE); @@ -269,14 +283,14 @@ var $sHelpPage = 'ktcore/admin/deleted documents.html'; $aErrorDocuments[] = $oDoc->getName(); continue; // skip transactions, etc. } - + $res = KTPermissionUtil::updatePermissionLookup($oDoc); - + if (PEAR::isError($res)) { $aErrorDocuments[] = $oDoc->getName(); continue; // skip transactions, etc. } - + // create a doc-transaction. // FIXME does this warrant a transaction-type? $oTransaction = new DocumentTransaction($oDoc, sprintf(_kt("Restored from deleted state by %s"), $this->oUser->getName()), 'ktcore.transactions.update'); @@ -293,14 +307,14 @@ var $sHelpPage = 'ktcore/admin/deleted documents.html'; $msg = sprintf(_kt('%d documents restored.'), count($aSuccessDocuments)); if (count($aErrorDocuments) != 0) { $msg .= _kt('Failed to restore') . ': ' . join(', ', $aErrorDocuments); } $this->successRedirectToMain($msg); - } - + } + function getRestoreLocationFor($oDocument) { - $iFolderId = $oDocument->getRestoreFolderId(); + $iFolderId = $oDocument->getRestoreFolderId(); $oFolder = Folder::get($iFolderId); - + if (PEAR::isError($oFolder)) { - return _kt('Original folder no longer exists. Document will be restored in the root folder.'); + return _kt('Original folder no longer exists. Document will be restored in the root folder.'); } else { $aCrumbs = KTBrowseUtil::breadcrumbsForFolder($oFolder); $aParts = array(); diff --git a/plugins/ktcore/admin/manageBranding.php b/plugins/ktcore/admin/manageBranding.php index 825e229..3613458 100755 --- a/plugins/ktcore/admin/manageBranding.php +++ b/plugins/ktcore/admin/manageBranding.php @@ -52,6 +52,7 @@ class ManageBrandDispatcher extends KTAdminDispatcher { private $maxLogoWidth = 313; private $maxLogoHeight = 50; + public $supportedTypes = array('gif', 'png', 'pjpeg', 'jpe', 'jpeg', 'jpg', 'jfif', 'jfif-tbnl'); function check() { @@ -104,7 +105,7 @@ class ManageBrandDispatcher extends KTAdminDispatcher { $aVocab['crop'] = 'Crop - Cut out a selection'; $aVocab['scale'] = 'Scale - Stretch or Shrink to fit'; - $aVocab['nothing'] = 'Don\'t do anything'; + $aVocab['nothing'] = 'Don\'t do anything (My image has the correct dimensions)'; //Adding document type lookup widget $widgets[] = $oWF->get('ktcore.widgets.selection',array( @@ -117,7 +118,7 @@ class ManageBrandDispatcher extends KTAdminDispatcher { 'label_method' => 'getName', 'simple_select' => true, )); - + $oForm->setWidgets($widgets); $oForm->setValidators($validators); @@ -306,11 +307,14 @@ class ManageBrandDispatcher extends KTAdminDispatcher { $logoFileName = 'var'.DIRECTORY_SEPARATOR.'branding'.DIRECTORY_SEPARATOR.'logo'.DIRECTORY_SEPARATOR.$logoFileName; - // Adding the Image Crop Widget + // Adding the Image Widget $widgets[] = $oWF->get('ktcore.widgets.image', array( 'label' => _kt('Logo Preview'), 'name' => $logoFileName, // title and alt attributes get set to this. 'value' => $logoFileName, + 'width' => $this->maxLogoWidth, + 'height' => $this->maxLogoHeight, + 'widgetwidth' => 20 )); // Adding the Hidden FileName Input String @@ -366,6 +370,21 @@ class ManageBrandDispatcher extends KTAdminDispatcher { //Changing to logo.jpg (Need to preserve extention as GD requires the exact image type to work) $ext = end(explode('.', $logoFileName)); + + $type = $_FILES['_kt_attempt_unique_file']['type']; + + //Stage 1 filename based ext check: + if (!$this->isSupportedExtension($ext)) { + //If filename based extension isn't supported will try and guess based on mime type + $default->log->error("Stage 1: Unsupported file type: '".$type."' for file: ':".$_FILES['_kt_attempt_unique_file']['name']."'"); + $ext = $this->getExtension($type); + + if (!$this->isSupportedExtension($ext)) { + $default->log->error("Unsupported file type: '".$type."' for file: ':".$_FILES['_kt_attempt_unique_file']['name']."'"); + $this->errorRedirectToMain("The file you tried to upload is not supported."); + } + } + $logoFileName = 'logo_tmp_'.md5(Date('ymd-hms')).'.'.$ext; //Fighting the browser cache here $logoFile = $logoDir.DIRECTORY_SEPARATOR.$logoFileName; @@ -373,7 +392,7 @@ class ManageBrandDispatcher extends KTAdminDispatcher { if (file_exists($logoFile)) { @unlink($logoFile); } - + //TODO: Test Upload Failure by setting the $logoFile to '' if(!move_uploaded_file($_FILES['_kt_attempt_unique_file']['tmp_name'], $logoFile)) { @@ -388,8 +407,14 @@ class ManageBrandDispatcher extends KTAdminDispatcher { switch ($resizeMethod) { case 'crop': - $cropLogoForm = $this->getCropLogoForm($logoFileName); - return $cropLogoForm->render(); + if ($this->isImageCroppable($logoFile, $this->maxLogoWith, $this->maxLogoHeight)) { + $retForm = $this->getCropLogoForm($logoFileName); + } else { + $_SESSION['KTErrorMessage'][] = _kt("The image was too small to be cropped."); + $retForm = $this->getApplyLogoForm($logoFileName); + } + + return $retForm->render(); case 'scale': $type = $_FILES['_kt_attempt_unique_file']['type']; @@ -421,6 +446,82 @@ class ManageBrandDispatcher extends KTAdminDispatcher { } + /** + * Returns the MIME of the filename, deducted from its extension + * If the extension is unknown, returns "image/jpeg" + */ + function getMime($filename) + { + $pos = strrpos($filename, '.'); + $extension = ""; + if ($pos !== false) { + $extension = strtolower(substr($filename, $pos+1)); + } + + switch($extension) { + case 'gif': + return 'image/gif'; + case 'jfif': + return 'image/jpeg'; + case 'jfif-tbnl': + return 'image/jpeg'; + case 'png': + return 'image/png'; + case 'jpe': + return 'image/jpeg'; + case 'jpeg': + return 'image/jpeg'; + case 'jpg': + return 'image/jpeg'; + default: + return 'image/jpeg'; + } + } + + + /** + * Returns the MIME of the filename, deducted from its extension + * If the extension is unknown, returns "image/jpeg" + */ + function getExtension($type) + { + + switch($type) { + case 'image/gif': + return 'gif'; + case 'image/jpeg': + return 'jfif'; + case 'image/jpeg': + return 'jfif-tbnl'; + case 'image/png': + return 'png'; + case 'image/jpeg': + return 'jpe'; + case 'image/jpeg': + return 'jpeg'; + case 'image/jpeg': + return 'jpg'; + case 'image/pjpeg': + return 'jpg'; + default: + return 'image/jpeg'; + } + } + + + /** + * Returns TRUE of the extension is supported + */ + function isSupportedExtension($extension) + { + if (in_array($extension, $this->supportedTypes)) { + return TRUE; + } + + return FALSE; + } + + /* * This method uses the GD library to scale an image. * - Supported images are jpeg, png and gif @@ -569,39 +670,60 @@ class ManageBrandDispatcher extends KTAdminDispatcher { } - - /** - * Returns the MIME of the filename, deducted from its extension - * If the extension is unknown, returns "image/jpeg" + /* + * This method is used to determine if the image actually can be cropped + * - Supported images are jpeg, png and gif + * */ - function getMime($filename) - { - $pos = strrpos($filename, '.'); - $extension = ""; - if ($pos !== false) { - $extension = strtolower(substr($filename, $pos+1)); + public function isImageCroppable( $origFile, $width, $height) { + global $default; + + //Requires the GD library if not exit gracefully + if (!extension_loaded('gd')) { + $default->log->error("The GD library isn't loaded"); + return false; + } + + switch($type) { + case 'image/jpeg': + $orig = imagecreatefromjpeg($origFile); + break; + case 'image/pjpeg': + $orig = imagecreatefromjpeg($origFile); + break; + case 'image/png': + $orig = imagecreatefrompng($origFile); + break; + case 'image/gif': + $orig = imagecreatefromgif($origFile); + break; + default: + //Handle Error + $default->log->error("Tried to determine crop for an unsupported file type: $type"); + return false; } - switch($extension) { - case 'gif': - return 'image/gif'; - case 'jfif': - return 'image/jpeg'; - case 'jfif-tbnl': - return 'image/jpeg'; - case 'png': - return 'image/png'; - case 'jpe': - return 'image/jpeg'; - case 'jpeg': - return 'image/jpeg'; - case 'jpg': - return 'image/jpeg'; - default: - return 'image/jpeg'; + if($orig) { + /* + * calculate the size of the new image. + */ + $orig_x = imagesx($orig); + $orig_y = imagesy($orig); + + if (($orig_x > $width) || ($orig_y > $height)) { + return true; + } + + } else { + //Handle Error + $default->log->error("Couldn't obtain a valid GD resource $origFile"); + return false; } + + return true; } + /* * This method uses the GD library to crop an image. * - Supported images are jpeg, png and gif diff --git a/plugins/ktcore/admin/manageCleanup.php b/plugins/ktcore/admin/manageCleanup.php index dc2ac92..1588c1b 100755 --- a/plugins/ktcore/admin/manageCleanup.php +++ b/plugins/ktcore/admin/manageCleanup.php @@ -5,7 +5,7 @@ * KnowledgeTree Community Edition * Document Management Made Simple * Copyright (C) 2008, 2009 KnowledgeTree Inc. - * + * * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License version 3 as published by the @@ -69,6 +69,8 @@ class ManageCleanupDispatcher extends KTAdminDispatcher { function do_main() { + $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Document Storage Verification')); + $this->oPage->setTitle(_kt('Document Storage Verification')); $oForm = new KTForm; $oForm->setOptions(array( @@ -82,7 +84,12 @@ class ManageCleanupDispatcher extends KTAdminDispatcher { } - function do_verify() { + function do_verify() + { + $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Document Storage Verification')); + $this->oPage->setTitle(_kt('Document Storage Verification')); + $this->oPage->setBreadcrumbDetails(_kt('verify')); + global $aFoldersToRemove; global $aFilesToRemove; global $aRepoDocumentProblems; diff --git a/plugins/thumbnails/templates/thumbnail_viewlet.smarty b/plugins/thumbnails/templates/thumbnail_viewlet.smarty index de6b230..b618314 100755 --- a/plugins/thumbnails/templates/thumbnail_viewlet.smarty +++ b/plugins/thumbnails/templates/thumbnail_viewlet.smarty @@ -13,14 +13,16 @@
+
{else} - - - {/if} - - {if $url} - + {if $url} + + + + {else} + + {/if} {/if} \ No newline at end of file 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; } } diff --git a/templates/ktcore/forms/widgets/image.smarty b/templates/ktcore/forms/widgets/image.smarty index 2549474..df3b354 100755 --- a/templates/ktcore/forms/widgets/image.smarty +++ b/templates/ktcore/forms/widgets/image.smarty @@ -1 +1 @@ - {$name} + {$name}