Allow larger images/videos to be uploaded if they are going to be converted

- 변환 대상인 이미지나 동영상 파일은 용량 제한을 더 느슨하게 설정할 수 있도록 함
- 변환 후에 다시 용량을 체크하여 각 게시판의 업로드 정책 적용
- https://rhymix.org/qna/1926104
This commit is contained in:
Kijin Sung 2026-03-10 19:45:38 +09:00
parent 44cf008ac7
commit 94008fbe9b
10 changed files with 87 additions and 7 deletions

View file

@ -235,13 +235,17 @@ class EditorModel extends Editor
{
// Get file upload limits
$file_config = FileModel::getUploadConfig();
$file_config->allowed_attach_size = $file_config->allowed_attach_size*1024*1024;
$file_config->allowed_filesize = $file_config->allowed_filesize*1024*1024;
$file_config->allowed_attach_size = $file_config->allowed_attach_size * 1048576;
$file_config->allowed_filesize = $file_config->allowed_filesize * 1048576;
if (isset($option->allowed_filesize) && $option->allowed_filesize > 0)
{
$file_config->allowed_attach_size = $option->allowed_filesize;
$file_config->allowed_filesize = $option->allowed_filesize;
}
if (isset($file_config->pre_conversion_filesize))
{
$file_config->pre_conversion_filesize = $file_config->pre_conversion_filesize * 1048576;
}
// Calculate the appropriate chunk size.
$file_config->allowed_chunk_size = min(FileHandler::returnBytes(ini_get('upload_max_filesize')), FileHandler::returnBytes(ini_get('post_max_size')) * 0.95, 64 * 1024 * 1024);

View file

@ -12,6 +12,8 @@
data-editor-status="{json_encode(FileModel::getInstance()->getFileList($editor_sequence), JSON_UNESCAPED_UNICODE)}"
data-max-file-size="{$this->user->isAdmin() ? 0 : $file_config->allowed_filesize}"
data-max-chunk-size="{$file_config->allowed_chunk_size ?: 0}"
data-pre-conversion-size="{intval($file_config->pre_conversion_filesize ?? 0)}"
data-pre-conversion-types="{implode(',', $file_config->pre_conversion_types ?? [])}"
data-autoinsert-types="{json_encode($editor_autoinsert_types)}"
data-autoinsert-position="{$editor_autoinsert_position ?: 'paragraph'}">

View file

@ -10,6 +10,8 @@ $(function() {
container.data('instance', container.xeUploader({
maxFileSize: parseInt(data.maxFileSize, 10),
maxChunkSize: parseInt(data.maxChunkSize, 10),
preConversionSize: parseInt(data.preConversionSize || 0, 10),
preConversionTypes: data.preConversionTypes ? data.preConversionTypes.split(',') : [],
autoinsertTypes: data.autoinsertTypes,
autoinsertPosition: data.autoinsertPosition,
singleFileUploads: true