mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 11:11:39 +09:00
파일이나 확장자가 이미지, 오디오, 동영상이며, MIME 타입이 전혀 다른 경우에만 확장자를 고치도록 수정
direct가 아닌 첨부파일 본문 삽입시의 오류 수정 이미지, 오디오, 동영상 MIME 타입을 mime_content_type()의 반환값으로 수정
This commit is contained in:
parent
ac9141b4f2
commit
6db830c4c4
9 changed files with 122 additions and 100 deletions
|
|
@ -884,17 +884,13 @@ class fileController extends file
|
|||
$file_info['converted'] = false;
|
||||
|
||||
// Correct extension
|
||||
if($extension_by_type = Rhymix\Framework\MIME::getExtensionByType($file_info['type']))
|
||||
if($file_info['extension'])
|
||||
{
|
||||
$target_types = ['image', 'audio', 'video'];
|
||||
if(in_array(array_shift(explode('/', $file_info['type'])), $target_types))
|
||||
$type_by_extension = Rhymix\Framework\MIME::getTypeByExtension($file_info['extension']);
|
||||
if(!in_array($type_by_extension, [$file_info['type'], 'application/octet-stream']))
|
||||
{
|
||||
$file_info['extension'] = $extension_by_type;
|
||||
}
|
||||
elseif($file_info['extension'])
|
||||
{
|
||||
$type_by_extension = Rhymix\Framework\MIME::getTypeByExtension($file_info['extension']);
|
||||
if(in_array(array_shift(explode('/', $type_by_extension)), $target_types))
|
||||
$extension_by_type = Rhymix\Framework\MIME::getExtensionByType($file_info['type']);
|
||||
if($extension_by_type && preg_match('@^(?:image|audio|video)/@m', $file_info['type'] . PHP_EOL . $type_by_extension))
|
||||
{
|
||||
$file_info['extension'] = $extension_by_type;
|
||||
}
|
||||
|
|
@ -924,7 +920,7 @@ class fileController extends file
|
|||
}
|
||||
|
||||
// video
|
||||
if(in_array($file_info['extension'], ['mp4', 'webm', 'ogg']))
|
||||
if(in_array($file_info['extension'], ['mp4', 'webm', 'ogv']))
|
||||
{
|
||||
$file_info = $this->adjustUploadedVideo($file_info, $config);
|
||||
}
|
||||
|
|
@ -1123,7 +1119,7 @@ class fileController extends file
|
|||
}
|
||||
|
||||
// Adjust image rotation
|
||||
if ($config->image_autorotate && in_array($image_info['type'], ['jpg', 'jpeg']) && function_exists('exif_read_data'))
|
||||
if ($config->image_autorotate && $image_info['type'] === 'jpg' && function_exists('exif_read_data'))
|
||||
{
|
||||
$exif = @exif_read_data($file_info['tmp_name']);
|
||||
if($exif && isset($exif['Orientation']))
|
||||
|
|
|
|||
|
|
@ -98,4 +98,5 @@ $lang->video_mp4_gif_time = 'Treat as GIF';
|
|||
$lang->about_video_mp4_gif_time = 'treat silent MP4 videos with duration less than the set time as GIF images, and play with auto and loop.';
|
||||
$lang->ffmpeg_path = 'FFmpeg path';
|
||||
$lang->ffprobe_path = 'FFprobe path';
|
||||
$lang->msg_cannot_use_ffmpeg = 'FFmpeg and FFprobe must can be executed by PHP';
|
||||
$lang->msg_cannot_use_ffmpeg = 'FFmpeg and FFprobe must can be executed by PHP.';
|
||||
$lang->msg_cannot_use_exif = 'PHP Exif module is required.';
|
||||
|
|
@ -100,3 +100,4 @@ $lang->about_video_mp4_gif_time = '설정된 시간 이하의 길이를 가진
|
|||
$lang->ffmpeg_path = 'FFmpeg 경로';
|
||||
$lang->ffprobe_path = 'FFprobe 경로';
|
||||
$lang->msg_cannot_use_ffmpeg = 'PHP에서 FFmpeg 및 FFprobe를 실행할 수 있어야 합니다.';
|
||||
$lang->msg_cannot_use_exif = 'PHP Exif 모듈이 필요합니다.';
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@
|
|||
{$lang->cmd_no}
|
||||
</label>
|
||||
<p class="x_help-block">{$lang->about_image_autorotate}</p>
|
||||
<p class="x_text-info" cond="!function_exists('exif_read_data')">{$lang->msg_cannot_use_exif}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@
|
|||
{$lang->cmd_no}
|
||||
</label>
|
||||
<p class="x_help-block">{$lang->about_image_autorotate}</p>
|
||||
<p class="x_text-info" cond="!function_exists('exif_read_data')">{$lang->msg_cannot_use_exif}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue