mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 17:51:40 +09:00
Make JPG quality in document/comment thumbnails configurable, too
This commit is contained in:
parent
94efb351f7
commit
68076b40c6
8 changed files with 20 additions and 3 deletions
|
|
@ -479,7 +479,7 @@ class FileHandler
|
||||||
* @param int $resize_height Height to resize
|
* @param int $resize_height Height to resize
|
||||||
* @param string $target_type If $target_type is set (gif, jpg, png, bmp), result image will be saved as target type
|
* @param string $target_type If $target_type is set (gif, jpg, png, bmp), result image will be saved as target type
|
||||||
* @param string $thumbnail_type Thumbnail type(crop, ratio)
|
* @param string $thumbnail_type Thumbnail type(crop, ratio)
|
||||||
* @param int $quality Compression ratio (0~9)
|
* @param int $quality Compression ratio (0~100)
|
||||||
* @param int $rotate Rotation degrees (0~360)
|
* @param int $rotate Rotation degrees (0~360)
|
||||||
* @return bool TRUE: success, FALSE: failed
|
* @return bool TRUE: success, FALSE: failed
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -758,6 +758,7 @@ class adminAdminController extends admin
|
||||||
$document_config = $oDocumentModel->getDocumentConfig();
|
$document_config = $oDocumentModel->getDocumentConfig();
|
||||||
$document_config->thumbnail_target = $vars->thumbnail_target ?: 'all';
|
$document_config->thumbnail_target = $vars->thumbnail_target ?: 'all';
|
||||||
$document_config->thumbnail_type = $vars->thumbnail_type ?: 'crop';
|
$document_config->thumbnail_type = $vars->thumbnail_type ?: 'crop';
|
||||||
|
$document_config->thumbnail_quality = intval($vars->thumbnail_quality) ?: 75;
|
||||||
$oModuleController = getController('module');
|
$oModuleController = getController('module');
|
||||||
$oModuleController->insertModuleConfig('document', $document_config);
|
$oModuleController->insertModuleConfig('document', $document_config);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -517,6 +517,7 @@ class adminAdminView extends admin
|
||||||
$config = $oDocumentModel->getDocumentConfig();
|
$config = $oDocumentModel->getDocumentConfig();
|
||||||
Context::set('thumbnail_target', $config->thumbnail_target ?: 'all');
|
Context::set('thumbnail_target', $config->thumbnail_target ?: 'all');
|
||||||
Context::set('thumbnail_type', $config->thumbnail_type ?: 'crop');
|
Context::set('thumbnail_type', $config->thumbnail_type ?: 'crop');
|
||||||
|
Context::set('thumbnail_quality', $config->thumbnail_quality ?: 75);
|
||||||
if ($config->thumbnail_type === 'none')
|
if ($config->thumbnail_type === 'none')
|
||||||
{
|
{
|
||||||
Context::set('thumbnail_target', 'none');
|
Context::set('thumbnail_target', 'none');
|
||||||
|
|
|
||||||
|
|
@ -270,6 +270,7 @@ $lang->thumbnail_target = 'Extract Thumbnail From';
|
||||||
$lang->thumbnail_target_all = 'All images';
|
$lang->thumbnail_target_all = 'All images';
|
||||||
$lang->thumbnail_target_attachment = 'Attached images only';
|
$lang->thumbnail_target_attachment = 'Attached images only';
|
||||||
$lang->thumbnail_type = 'Thumbnail Type';
|
$lang->thumbnail_type = 'Thumbnail Type';
|
||||||
|
$lang->thumbnail_quality = 'Quality';
|
||||||
$lang->input_header_script = 'Header Script';
|
$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->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->input_footer_script = 'Footer Script';
|
||||||
|
|
|
||||||
|
|
@ -273,6 +273,7 @@ $lang->detail_input_footer_script = '모든 페이지의 최하단에 코드를
|
||||||
$lang->thumbnail_crop = '크기에 맞추어 잘라내기';
|
$lang->thumbnail_crop = '크기에 맞추어 잘라내기';
|
||||||
$lang->thumbnail_ratio = '비율 유지 (여백이 생길 수 있음)';
|
$lang->thumbnail_ratio = '비율 유지 (여백이 생길 수 있음)';
|
||||||
$lang->thumbnail_none = '썸네일 생성하지 않음';
|
$lang->thumbnail_none = '썸네일 생성하지 않음';
|
||||||
|
$lang->thumbnail_quality = '화질';
|
||||||
$lang->admin_ip_allow = '관리자 로그인 허용 IP';
|
$lang->admin_ip_allow = '관리자 로그인 허용 IP';
|
||||||
$lang->admin_ip_deny = '관리자 로그인 금지 IP';
|
$lang->admin_ip_deny = '관리자 로그인 금지 IP';
|
||||||
$lang->local_ip_address = '로컬 IP 주소';
|
$lang->local_ip_address = '로컬 IP 주소';
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,11 @@
|
||||||
<input type="radio" name="thumbnail_type" id="thumbnail_type_ratio" value="ratio" checked="checked"|cond="$thumbnail_type == 'ratio'" />
|
<input type="radio" name="thumbnail_type" id="thumbnail_type_ratio" value="ratio" checked="checked"|cond="$thumbnail_type == 'ratio'" />
|
||||||
{$lang->thumbnail_ratio}
|
{$lang->thumbnail_ratio}
|
||||||
</label>
|
</label>
|
||||||
|
<select name="thumbnail_quality" id="thumbnail_quality" style="width:100px;min-width:100px">
|
||||||
|
<!--@for($q = 50; $q <= 100; $q += 5)-->
|
||||||
|
<option value="{$q}" selected="selected"|cond="$thumbnail_quality == $q">{$lang->thumbnail_quality} {$q}%</option>
|
||||||
|
<!--@endfor-->
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="x_control-group">
|
<div class="x_control-group">
|
||||||
|
|
|
||||||
|
|
@ -656,6 +656,10 @@ class commentItem extends BaseObject
|
||||||
{
|
{
|
||||||
$thumbnail_type = $config->thumbnail_type ?: 'crop';
|
$thumbnail_type = $config->thumbnail_type ?: 'crop';
|
||||||
}
|
}
|
||||||
|
if(!$config->thumbnail_quality)
|
||||||
|
{
|
||||||
|
$config->thumbnail_quality = 75;
|
||||||
|
}
|
||||||
|
|
||||||
if(!$this->isAccessible())
|
if(!$this->isAccessible())
|
||||||
{
|
{
|
||||||
|
|
@ -785,7 +789,7 @@ class commentItem extends BaseObject
|
||||||
|
|
||||||
if($source_file)
|
if($source_file)
|
||||||
{
|
{
|
||||||
$output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
|
$output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type, $config->thumbnail_quality);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove source file if it was temporary
|
// Remove source file if it was temporary
|
||||||
|
|
|
||||||
|
|
@ -1009,6 +1009,10 @@ class documentItem extends BaseObject
|
||||||
{
|
{
|
||||||
$thumbnail_type = $config->thumbnail_type ?: 'crop';
|
$thumbnail_type = $config->thumbnail_type ?: 'crop';
|
||||||
}
|
}
|
||||||
|
if(!$config->thumbnail_quality)
|
||||||
|
{
|
||||||
|
$config->thumbnail_quality = 75;
|
||||||
|
}
|
||||||
|
|
||||||
if(!$this->isAccessible())
|
if(!$this->isAccessible())
|
||||||
{
|
{
|
||||||
|
|
@ -1143,7 +1147,7 @@ class documentItem extends BaseObject
|
||||||
|
|
||||||
if($source_file)
|
if($source_file)
|
||||||
{
|
{
|
||||||
$output_file = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
|
$output_file = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type, $config->thumbnail_quality);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove source file if it was temporary
|
// Remove source file if it was temporary
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue