Set 'fill' as default thumbnail method

This commit is contained in:
Kijin Sung 2021-01-19 17:42:00 +09:00
parent 175b797ee1
commit 71d71a886c
7 changed files with 29 additions and 22 deletions

View file

@ -490,7 +490,7 @@ class FileHandler
* @param int $rotate Rotation degrees (0~360)
* @return bool TRUE: success, FALSE: failed
*/
public static function createImageFile($source_file, $target_file, $resize_width = 0, $resize_height = 0, $target_type = '', $thumbnail_type = 'crop', $quality = 100, $rotate = 0)
public static function createImageFile($source_file, $target_file, $resize_width = 0, $resize_height = 0, $target_type = '', $thumbnail_type = 'fill', $quality = 100, $rotate = 0)
{
// check params
if (($source_file = self::exists($source_file)) === FALSE)

View file

@ -808,7 +808,7 @@ class adminAdminController extends admin
$oDocumentModel = getModel('document');
$document_config = $oDocumentModel->getDocumentConfig();
$document_config->thumbnail_target = $vars->thumbnail_target ?: 'all';
$document_config->thumbnail_type = $vars->thumbnail_type ?: 'crop';
$document_config->thumbnail_type = $vars->thumbnail_type ?: 'fill';
$document_config->thumbnail_quality = intval($vars->thumbnail_quality) ?: 75;
$oModuleController = getController('module');
$oModuleController->insertModuleConfig('document', $document_config);

View file

@ -286,8 +286,11 @@ $lang->input_header_script = 'Header Script';
$lang->detail_input_header_script = 'Content added here will be printed at the top of every page, except the admin module.';
$lang->input_footer_script = 'Footer Script';
$lang->detail_input_footer_script = 'Content added here will be printed at the bottom of every page, except the admin module.';
$lang->thumbnail_fill = 'Fill';
$lang->thumbnail_ratio = 'Letterbox';
$lang->thumbnail_crop = 'Crop';
$lang->thumbnail_ratio = 'Keep aspect ratio (may result in spaces)';
$lang->thumbnail_stretch = 'Stretch';
$lang->thumbnail_center = 'Center';
$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';

View file

@ -282,8 +282,11 @@ $lang->input_header_script = '상단(헤더) 스크립트';
$lang->detail_input_header_script = '모든 페이지의 최상단에 코드를 삽입합니다. 관리자 화면에는 적용되지 않습니다.';
$lang->input_footer_script = '하단(푸터) 스크립트';
$lang->detail_input_footer_script = '모든 페이지의 최하단에 코드를 삽입합니다. 관리자 화면에는 적용되지 않습니다.';
$lang->thumbnail_crop = '크기에 맞추어 잘라내기';
$lang->thumbnail_ratio = '비율 유지 (여백이 생길 수 있음)';
$lang->thumbnail_fill = '비율 유지하며 가득 채움';
$lang->thumbnail_ratio = '비율 유지하며 잘리지 않도록 함';
$lang->thumbnail_crop = '비율 유지하며 잘라내기';
$lang->thumbnail_stretch = '비율 유지하지 않고 확대 및 축소';
$lang->thumbnail_center = '가운데 부분만 표시';
$lang->thumbnail_none = '썸네일 생성하지 않음';
$lang->admin_ip_allow = '관리자 로그인 허용 IP';
$lang->admin_ip_deny = '관리자 로그인 금지 IP';

View file

@ -128,21 +128,22 @@
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->thumbnail_type}</label>
<label class="x_control-label" for="thumbnail_type">{$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 == '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->thumbnail_ratio}
</label>
<select name="thumbnail_quality" id="thumbnail_quality" style="min-width:120px">
<!--@for($q = 50; $q <= 100; $q += 5)-->
<option value="{$q}" selected="selected"|cond="$thumbnail_quality === $q">{$lang->image_quality} {$q}%<!--@if($q === 75)--> ({$lang->standard})<!--@end--></option>
<!--@endfor-->
<select name="thumbnail_type" id="thumbnail_type">
<option value="fill" selected="selected"|cond="$thumbnail_type == 'fill'">{$lang->thumbnail_fill}</option>
<option value="ratio" selected="selected"|cond="$thumbnail_type == 'ratio'">{$lang->thumbnail_ratio}</option>
<option value="crop" selected="selected"|cond="$thumbnail_type == 'crop'">{$lang->thumbnail_crop}</option>
<option value="stretch" selected="selected"|cond="$thumbnail_type == 'stretch'">{$lang->thumbnail_stretch}</option>
<option value="center" selected="selected"|cond="$thumbnail_type == 'center'">{$lang->thumbnail_center}</option>
</select>
<label class="x_inline" for="thumbnail_quality" style="margin-left:16px">{$lang->image_quality}:
<select name="thumbnail_quality" id="thumbnail_quality" style="min-width:120px">
<!--@for($q = 50; $q <= 100; $q += 5)-->
<option value="{$q}" selected="selected"|cond="$thumbnail_quality === $q">{$q}%<!--@if($q === 75)--> ({$lang->standard})<!--@end--></option>
<!--@endfor-->
</select>
</label>
</div>
</div>
<div class="x_control-group">

View file

@ -646,9 +646,9 @@ class commentItem extends BaseObject
{
return;
}
if(!in_array($thumbnail_type, array('crop', 'ratio')))
if(!in_array($thumbnail_type, array('crop', 'ratio', 'fill', 'stretch', 'center')))
{
$thumbnail_type = $config->thumbnail_type ?: 'crop';
$thumbnail_type = $config->thumbnail_type ?: 'fill';
}
if(!$config->thumbnail_quality)
{

View file

@ -1072,9 +1072,9 @@ class documentItem extends BaseObject
{
return;
}
if(!in_array($thumbnail_type, array('crop', 'ratio')))
if(!in_array($thumbnail_type, array('crop', 'ratio', 'fill', 'stretch', 'center')))
{
$thumbnail_type = $config->thumbnail_type ?: 'crop';
$thumbnail_type = $config->thumbnail_type ?: 'fill';
}
if(!$config->thumbnail_quality)
{