Merge pull request #662 from kijin/pr/thumbnail-none

썸네일이 생성되지 않도록 하는 옵션 추가 (#607)
This commit is contained in:
Kijin Sung 2016-12-17 18:00:54 +09:00 committed by GitHub
commit 25af109191
10 changed files with 54 additions and 34 deletions

View file

@ -816,7 +816,7 @@ class adminAdminController extends admin
// Thumbnail settings
$oDocumentModel = getModel('document');
$document_config = $oDocumentModel->getDocumentConfig();
$document_config->thumbnail_type = $vars->thumbnail_type === 'ratio' ? 'ratio' : 'crop';
$document_config->thumbnail_type = $vars->thumbnail_type ?: 'crop';
$oModuleController = getController('module');
$oModuleController->insertModuleConfig('document', $document_config);

View file

@ -214,8 +214,9 @@ $lang->tablets_as_mobile = 'Treat Tablets as Mobile';
$lang->thumbnail_type = 'Select thumbnail type.';
$lang->input_footer_script = 'Footer script';
$lang->detail_input_footer_script = 'The script is inserted into the bottom of body. It does not work at admin page.';
$lang->corp = 'Crop (Cut)';
$lang->ratio = 'Ratio (Keep Aspect Ratio)';
$lang->thumbnail_crop = 'Crop';
$lang->thumbnail_ratio = 'Keep aspect ratio (may result in spaces)';
$lang->thumbnail_none = 'Do not create thumbnails';
$lang->admin_ip_allow = 'IP addresses allowed to log in as administrator';
$lang->admin_ip_deny = 'IP addresses forbidden to log in as administrator';
$lang->local_ip_address = 'Local IP address';

View file

@ -125,8 +125,9 @@ $lang->about_use_mobile_view = 'モバイル機器で接続した際にモバイ
$lang->thumbnail_type = 'サムネイルの作成方式を選択してください。';
$lang->input_footer_script = '下段footerスクリプト';
$lang->detail_input_footer_script = '最下段にコードを追加します。管理者ページでは遂行できません。';
$lang->corp = '切り取り';
$lang->ratio = 'Ratio(縦横の比率をキープ)';
$lang->thumbnail_crop = 'トリミングする';
$lang->thumbnail_ratio = '比率に合わせる';
$lang->thumbnail_none = 'サムネイルを作成しない';
$lang->admin_ip_allow = '管理者ログイン許容IP';
$lang->admin_ip_deny = '管理者ログイン禁止IP';
$lang->local_ip_address = 'ローカルIPアドレス';

View file

@ -209,8 +209,9 @@ $lang->tablets_as_mobile = '태블릿도 모바일 취급';
$lang->thumbnail_type = '썸네일 생성 방식';
$lang->input_footer_script = '하단(footer) 스크립트';
$lang->detail_input_footer_script = '최하단에 코드를 삽입합니다. 관리자 페이지에서는 수행되지 않습니다.';
$lang->corp = 'Crop (잘라내기)';
$lang->ratio = 'Ratio (비율 맞추기)';
$lang->thumbnail_crop = '크기에 맞추어 잘라내기';
$lang->thumbnail_ratio = '비율 유지 (여백이 생길 수 있음)';
$lang->thumbnail_none = '썸네일 생성하지 않음';
$lang->admin_ip_allow = '관리자 로그인 허용 IP';
$lang->admin_ip_deny = '관리자 로그인 금지 IP';
$lang->local_ip_address = '로컬 IP 주소';

View file

@ -62,12 +62,16 @@
<label class="x_control-label">{$lang->thumbnail_type}</label>
<div class="x_controls">
<label for="thumbnail_type_crop" class="x_inline">
<input type="radio" name="thumbnail_type" id="thumbnail_type_crop" value="crop" checked="checked"|cond="$thumbnail_type != 'ratio'" />
{$lang->corp}
<input type="radio" name="thumbnail_type" id="thumbnail_type_crop" value="crop" checked="checked"|cond="$thumbnail_type == 'crop' || !$thumbnail_type" />
{$lang->thumbnail_crop}
</label>
<label for="thumbnail_type_ratio" class="x_inline">
<input type="radio" name="thumbnail_type" id="thumbnail_type_ratio" value="ratio" checked="checked"|cond="$thumbnail_type == 'ratio'" />
{$lang->ratio}
{$lang->thumbnail_ratio}
</label>
<label for="thumbnail_type_none" class="x_inline">
<input type="radio" name="thumbnail_type" id="thumbnail_type_none" value="none" checked="checked"|cond="$thumbnail_type == 'none'" />
{$lang->thumbnail_none}
</label>
</div>
</div>

View file

@ -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);

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));

View file

@ -1,8 +1,6 @@
<?php
$lang->document_list = 'Documents List';
$lang->thumbnail_type = 'Thumbnail Type';
$lang->thumbnail_crop = 'Crop (to a specific size)';
$lang->thumbnail_ratio = 'Ratio (keeping the same aspect ratio as the original image)';
$lang->cmd_delete_all_thumbnail = 'Delete all thumbnails';
$lang->title_bold = 'Bold';
$lang->title_color = 'Color';

View file

@ -1,8 +1,6 @@
<?php
$lang->document_list = 'ドキュメントリスト';
$lang->thumbnail_type = 'サムネールタイプ';
$lang->thumbnail_crop = 'トリミングする';
$lang->thumbnail_ratio = '比率に合わせる';
$lang->cmd_delete_all_thumbnail = 'すべてのサムネール削除';
$lang->title_bold = 'タイトル太字';
$lang->title_color = 'タイトルの色';

View file

@ -6,8 +6,6 @@ $lang->view_count_option_all = '모두 계산';
$lang->view_count_option_some = '일부 계산';
$lang->view_count_option_once = '중복 금지';
$lang->view_count_option_none = '계산 안함';
$lang->thumbnail_crop = '잘라내기 (정해진 크기에 꽉 찬 모습의 썸네일을 만듭니다.)';
$lang->thumbnail_ratio = '비율 맞추기 (원본 이미지의 비율에 맞춥니다. 다만 정해진 크기에 여백이 생깁니다.)';
$lang->cmd_delete_all_thumbnail = '섬네일 모두 삭제';
$lang->title_bold = '제목 굵게';
$lang->title_color = '제목 색깔';