diff --git a/modules/comment/comment.item.php b/modules/comment/comment.item.php index db8fa09f0..04332540f 100644 --- a/modules/comment/comment.item.php +++ b/modules/comment/comment.item.php @@ -567,6 +567,24 @@ class commentItem extends Object return; } + // Get thumbnai_type information from document module's configuration + if(!in_array($thumbnail_type, array('crop', 'ratio', 'none'))) + { + $config = $GLOBALS['__document_config__']; + if(!$config) + { + $oDocumentModel = getModel('document'); + $config = $oDocumentModel->getDocumentConfig(); + $GLOBALS['__document_config__'] = $config; + } + $thumbnail_type = $config->thumbnail_type ?: 'crop'; + } + + if ($thumbnail_type === 'none') + { + return; + } + if($this->isSecret() && !$this->isGranted()) { return; @@ -584,12 +602,6 @@ class commentItem extends Object return; } - // get thumbail generation info on the doc module configuration. - if(!in_array($thumbnail_type, array('crop', 'ratio'))) - { - $thumbnail_type = 'crop'; - } - // Define thumbnail information $thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->comment_srl, 3)); $thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type); diff --git a/modules/document/document.item.php b/modules/document/document.item.php index 84970348a..c63279037 100644 --- a/modules/document/document.item.php +++ b/modules/document/document.item.php @@ -879,6 +879,24 @@ class documentItem extends Object // Return false if the document doesn't exist if(!$this->document_srl) return; + // Get thumbnai_type information from document module's configuration + if(!in_array($thumbnail_type, array('crop', 'ratio', 'none'))) + { + $config = $GLOBALS['__document_config__']; + if(!$config) + { + $oDocumentModel = getModel('document'); + $config = $oDocumentModel->getDocumentConfig(); + $GLOBALS['__document_config__'] = $config; + } + $thumbnail_type = $config->thumbnail_type ?: 'crop'; + } + + if ($thumbnail_type === 'none') + { + return; + } + if($this->isSecret() && !$this->isGranted()) { return; @@ -897,20 +915,9 @@ class documentItem extends Object $output = executeQuery('document.getDocument', $args); $content = $output->data->content; } + // Return false if neither attachement nor image files in the document if(!$this->get('uploaded_count') && !preg_match("!getDocumentConfig(); - $GLOBALS['__document_config__'] = $config; - } - $thumbnail_type = $config->thumbnail_type ?: 'crop'; - } // Define thumbnail information $thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($this->document_srl, 3));