Add configuration for thumbnail target

- 썸네일 생성 대상 설정과 썸네일 생성 방식 설정을 분리하여
  외부이미지 썸네일 생성을 방지할 수 있는 옵션 추가
- 문서 모듈과 관리 모듈에 흩어져 있는 썸네일 관련 언어파일을
  관리 모듈로 합침
This commit is contained in:
Kijin Sung 2017-09-12 14:20:05 +09:00
parent 28d5f12cf1
commit 1a6e84d9cc
22 changed files with 60 additions and 36 deletions

View file

@ -627,11 +627,11 @@ class commentItem extends Object
{
$config = $GLOBALS['__document_config__'] = getModel('document')->getDocumentConfig();
}
if ($config->thumbnail_type === 'none')
if ($config->thumbnail_target === 'none' || $config->thumbnail_type === 'none')
{
return;
}
if(!in_array($thumbnail_type, array('crop', 'ratio', 'none')))
if(!in_array($thumbnail_type, array('crop', 'ratio')))
{
$thumbnail_type = $config->thumbnail_type ?: 'crop';
}
@ -713,7 +713,7 @@ class commentItem extends Object
}
// get an image file from the doc content if no file attached.
if(!$source_file)
if(!$source_file && $config->thumbnail_target !== 'attachment')
{
preg_match_all("!<img\s[^>]*?src=(\"|')([^\"' ]*?)(\"|')!is", $this->get('content'), $matches, PREG_SET_ORDER);
foreach($matches as $match)
@ -762,7 +762,10 @@ class commentItem extends Object
}
}
$output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
if($source_file)
{
$output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
}
// Remove source file if it was temporary
if($is_tmp_file)