mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 10:41:40 +09:00
동영상 섬네일, GIF로 취급 기능 추가
이미지, 동영상 첨부시 구분할 수 있도록 그 섬네일에 play 아이콘 추가 모듈별 파일 설정시 파일 모듈의 업로드 기본, 이미지, 동영상 설정을 각각 달리 적용할 수 있도록 기본 설정 제어 옵션 분리
This commit is contained in:
parent
c2025c4bde
commit
cdbc2d7a82
14 changed files with 644 additions and 430 deletions
|
|
@ -47,11 +47,9 @@ class fileAdminController extends file
|
|||
|
||||
$oFileController->deleteFile($file_srl);
|
||||
}
|
||||
|
||||
$this->setMessage( sprintf(lang('msg_checked_file_is_deleted'), $file_count) );
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminList');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
|
||||
$this->setMessage(sprintf(lang('msg_checked_file_is_deleted'), $file_count));
|
||||
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminList'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -66,19 +64,20 @@ class fileAdminController extends file
|
|||
$config->allowed_filesize = Context::get('allowed_filesize');
|
||||
$config->allowed_attach_size = Context::get('allowed_attach_size');
|
||||
$config->allowed_filetypes = Context::get('allowed_filetypes');
|
||||
$config->max_image_width = intval(Context::get('max_image_width')) ?: '';
|
||||
$config->max_image_height = intval(Context::get('max_image_height')) ?: '';
|
||||
$config->max_image_size_action = Context::get('max_image_size_action') ?: '';
|
||||
$config->max_image_size_quality = max(50, min(100, intval(Context::get('max_image_size_quality'))));
|
||||
$config->max_image_size_admin = Context::get('max_image_size_admin') === 'Y' ? 'Y' : 'N';
|
||||
$config->image_autoconv['bmp2jpg'] = Context::get('image_autoconv_bmp2jpg') === 'Y' ? true : false;
|
||||
$config->image_autoconv['png2jpg'] = Context::get('image_autoconv_png2jpg') === 'Y' ? true : false;
|
||||
$config->image_autoconv['webp2jpg'] = Context::get('image_autoconv_webp2jpg') === 'Y' ? true : false;
|
||||
$config->image_autoconv['gif2mp4'] = Context::get('image_autoconv_gif2mp4') === 'Y' ? true : false;
|
||||
$config->image_autoconv_quality = max(50, min(100, intval(Context::get('image_autoconv_quality'))));
|
||||
$config->ffmpeg_command = escape(utf8_trim(Context::get('ffmpeg_command'))) ?: '/usr/bin/ffmpeg';
|
||||
$config->max_image_width = intval(Context::get('max_image_width')) ?: '';
|
||||
$config->max_image_height = intval(Context::get('max_image_height')) ?: '';
|
||||
$config->max_image_size_action = Context::get('max_image_size_action') ?: '';
|
||||
$config->max_image_size_admin = Context::get('max_image_size_admin') === 'Y' ? 'Y' : 'N';
|
||||
$config->image_quality_adjustment = max(50, min(100, intval(Context::get('image_quality_adjustment'))));
|
||||
$config->image_autorotate = Context::get('image_autorotate') === 'Y' ? true : false;
|
||||
$config->image_autorotate_quality = max(50, min(100, intval(Context::get('image_autorotate_quality'))));
|
||||
$config->video_thumbnail = Context::get('video_thumbnail') === 'Y' ? true : false;
|
||||
$config->video_mp4_gif_time = intval(Context::get('video_mp4_gif_time'));
|
||||
$config->ffmpeg_command = escape(utf8_trim(Context::get('ffmpeg_command'))) ?: '/usr/bin/ffmpeg';
|
||||
$config->ffprobe_command = escape(utf8_trim(Context::get('ffprobe_command'))) ?: '/usr/bin/ffprobe';
|
||||
|
||||
// Check maximum file size
|
||||
if (PHP_INT_SIZE < 8)
|
||||
|
|
@ -105,10 +104,8 @@ class fileAdminController extends file
|
|||
}
|
||||
|
||||
// Save and redirect
|
||||
$oModuleController = getController('module');
|
||||
$output = $oModuleController->insertModuleConfig('file',$config);
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminUploadConfig');
|
||||
$output = getController('module')->insertModuleConfig('file', $config);
|
||||
$returnUrl = Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminUploadConfig');
|
||||
return $this->setRedirectUrl($returnUrl, $output);
|
||||
}
|
||||
|
||||
|
|
@ -127,14 +124,8 @@ class fileAdminController extends file
|
|||
$config->inline_download_format = array_map('utf8_trim', Context::get('inline_download_format'));
|
||||
|
||||
// Save and redirect
|
||||
$oModuleController = getController('module');
|
||||
$output = $oModuleController->insertModuleConfig('file',$config);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminDownloadConfig');
|
||||
$output = getController('module')->insertModuleConfig('file', $config);
|
||||
$returnUrl = Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminDownloadConfig');
|
||||
return $this->setRedirectUrl($returnUrl, $output);
|
||||
}
|
||||
|
||||
|
|
@ -150,14 +141,8 @@ class fileAdminController extends file
|
|||
$config->save_changelog = Context::get('save_changelog') === 'Y' ? 'Y' : 'N';
|
||||
|
||||
// Save and redirect
|
||||
$oModuleController = getController('module');
|
||||
$output = $oModuleController->insertModuleConfig('file',$config);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminOtherConfig');
|
||||
$output = getController('module')->insertModuleConfig('file', $config);
|
||||
$returnUrl = Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminOtherConfig');
|
||||
return $this->setRedirectUrl($returnUrl, $output);
|
||||
}
|
||||
|
||||
|
|
@ -168,59 +153,63 @@ class fileAdminController extends file
|
|||
*/
|
||||
function procFileAdminInsertModuleConfig()
|
||||
{
|
||||
// Get variables
|
||||
$module_srl = Context::get('target_module_srl');
|
||||
// In order to configure multiple modules at once
|
||||
if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
|
||||
else $module_srl = array($module_srl);
|
||||
|
||||
$file_config = new stdClass;
|
||||
$file_config->allowed_filesize = Context::get('allowed_filesize');
|
||||
$file_config->allowed_attach_size = Context::get('allowed_attach_size');
|
||||
$file_config->allowed_filetypes = Context::get('allowed_filetypes');
|
||||
$file_config->max_image_width = intval(Context::get('max_image_width')) ?: '';
|
||||
$file_config->max_image_height = intval(Context::get('max_image_height')) ?: '';
|
||||
$file_config->max_image_size_action = Context::get('max_image_size_action') ?: '';
|
||||
$file_config->max_image_size_quality = max(50, min(100, intval(Context::get('max_image_size_quality'))));
|
||||
$file_config->max_image_size_admin = Context::get('max_image_size_admin') === 'Y' ? 'Y' : 'N';
|
||||
$file_config->image_autoconv['bmp2jpg'] = Context::get('image_autoconv_bmp2jpg') === 'Y' ? true : false;
|
||||
$file_config->image_autoconv['png2jpg'] = Context::get('image_autoconv_png2jpg') === 'Y' ? true : false;
|
||||
$file_config->image_autoconv['webp2jpg'] = Context::get('image_autoconv_webp2jpg') === 'Y' ? true : false;
|
||||
$file_config->image_autoconv['gif2mp4'] = Context::get('image_autoconv_gif2mp4') === 'Y' ? true : false;
|
||||
$file_config->image_autoconv_quality = max(50, min(100, intval(Context::get('image_autoconv_quality'))));
|
||||
$file_config->ffmpeg_command = escape(utf8_trim(Context::get('ffmpeg_command'))) ?: '/usr/bin/ffmpeg';
|
||||
$file_config->image_autorotate = Context::get('image_autorotate') === 'Y' ? true : false;
|
||||
$file_config->image_autorotate_quality = max(50, min(100, intval(Context::get('image_autorotate_quality'))));
|
||||
|
||||
// Check maximum file size
|
||||
if (PHP_INT_SIZE < 8)
|
||||
|
||||
// Default
|
||||
if(!Context::get('use_default_file_config'))
|
||||
{
|
||||
if ($file_config->allowed_filesize > 2047 || $file_config->allowed_attach_size > 2047)
|
||||
$file_config->use_default_file_config = 'N';
|
||||
$file_config->allowed_filesize = Context::get('allowed_filesize');
|
||||
$file_config->allowed_attach_size = Context::get('allowed_attach_size');
|
||||
$file_config->allowed_filetypes = Context::get('allowed_filetypes');
|
||||
|
||||
// Check maximum file size
|
||||
if (PHP_INT_SIZE < 8)
|
||||
{
|
||||
throw new Rhymix\Framework\Exception('msg_32bit_max_2047mb');
|
||||
if ($file_config->allowed_filesize > 2047 || $file_config->allowed_attach_size > 2047)
|
||||
{
|
||||
throw new Rhymix\Framework\Exception('msg_32bit_max_2047mb');
|
||||
}
|
||||
}
|
||||
|
||||
// Simplify allowed_filetypes
|
||||
$file_config->allowed_extensions = strtr(strtolower(trim($file_config->allowed_filetypes)), array('*.' => '', ';' => ','));
|
||||
if ($file_config->allowed_extensions)
|
||||
{
|
||||
$file_config->allowed_extensions = array_map('trim', explode(',', $file_config->allowed_filetypes));
|
||||
$file_config->allowed_filetypes = implode(';', array_map(function($ext) {
|
||||
return '*.' . $ext;
|
||||
}, $file_config->allowed_extensions));
|
||||
}
|
||||
else
|
||||
{
|
||||
$file_config->allowed_extensions = array();
|
||||
$file_config->allowed_filetypes = '*.*';
|
||||
}
|
||||
}
|
||||
|
||||
// Simplify allowed_filetypes
|
||||
$file_config->allowed_extensions = strtr(strtolower(trim($file_config->allowed_filetypes)), array('*.' => '', ';' => ','));
|
||||
if ($file_config->allowed_extensions)
|
||||
// Image
|
||||
if(!Context::get('use_image_default_file_config'))
|
||||
{
|
||||
$file_config->allowed_extensions = array_map('trim', explode(',', $file_config->allowed_filetypes));
|
||||
$file_config->allowed_filetypes = implode(';', array_map(function($ext) {
|
||||
return '*.' . $ext;
|
||||
}, $file_config->allowed_extensions));
|
||||
}
|
||||
else
|
||||
{
|
||||
$file_config->allowed_extensions = array();
|
||||
$file_config->allowed_filetypes = '*.*';
|
||||
$file_config->use_image_default_file_config = 'N';
|
||||
$file_config->image_autoconv['bmp2jpg'] = Context::get('image_autoconv_bmp2jpg') === 'Y' ? true : false;
|
||||
$file_config->image_autoconv['png2jpg'] = Context::get('image_autoconv_png2jpg') === 'Y' ? true : false;
|
||||
$file_config->image_autoconv['webp2jpg'] = Context::get('image_autoconv_webp2jpg') === 'Y' ? true : false;
|
||||
$file_config->image_autoconv['gif2mp4'] = Context::get('image_autoconv_gif2mp4') === 'Y' ? true : false;
|
||||
$file_config->max_image_width = intval(Context::get('max_image_width')) ?: '';
|
||||
$file_config->max_image_height = intval(Context::get('max_image_height')) ?: '';
|
||||
$file_config->max_image_size_action = Context::get('max_image_size_action') ?: '';
|
||||
$file_config->max_image_size_admin = Context::get('max_image_size_admin') === 'Y' ? 'Y' : 'N';
|
||||
$file_config->image_quality_adjustment = max(50, min(100, intval(Context::get('image_quality_adjustment'))));
|
||||
$file_config->image_autorotate = Context::get('image_autorotate') === 'Y' ? true : false;
|
||||
}
|
||||
|
||||
// Use default config
|
||||
if(Context::get('use_default_file_config') === 'Y')
|
||||
// Video
|
||||
if(!Context::get('use_video_default_file_config'))
|
||||
{
|
||||
$file_config = new stdClass;
|
||||
$file_config->use_default_file_config = true;
|
||||
$file_config->use_video_default_file_config = 'N';
|
||||
$file_config->video_thumbnail = Context::get('video_thumbnail') === 'Y' ? true : false;
|
||||
$file_config->video_mp4_gif_time = intval(Context::get('video_mp4_gif_time'));
|
||||
}
|
||||
|
||||
// Check download grant
|
||||
|
|
@ -233,19 +222,21 @@ class fileAdminController extends file
|
|||
{
|
||||
$file_config->download_grant = array_values($download_grant);
|
||||
}
|
||||
|
||||
// Update
|
||||
$oModuleController = getController('module');
|
||||
for($i=0;$i<count($module_srl);$i++)
|
||||
foreach(explode(',', Context::get('target_module_srl')) as $module_srl)
|
||||
{
|
||||
$srl = trim($module_srl[$i]);
|
||||
if(!$srl) continue;
|
||||
$oModuleController->insertModulePartConfig('file',$srl,$file_config);
|
||||
$output = $oModuleController->insertModulePartConfig('file', trim($module_srl), $file_config);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->setError(-1);
|
||||
$this->setMessage('success_updated', 'info');
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispBoardAdminContent');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispBoardAdminContent'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue