Do not create thumbnails if thumbnail_type is none

This commit is contained in:
Kijin Sung 2016-12-17 17:48:32 +09:00
parent 73a690bfae
commit af7bab4814
2 changed files with 37 additions and 18 deletions

View file

@ -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("!<img!is", $content)) return;
// Get thumbnai_type information from document module's configuration
if(!in_array($thumbnail_type, array('crop','ratio')))
{
$config = $GLOBALS['__document_config__'];
if(!$config)
{
$oDocumentModel = getModel('document');
$config = $oDocumentModel->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));