mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-07-01 16:22:49 +08:00
fix(admin): 统一jpe/jpeg扩展名为jpg
检测到文件MIME类型对应的扩展名为jpe或jpeg时,统一转换为更常见的jpg格式,确保后续文件路径处理的一致性。
This commit is contained in:
@@ -104,6 +104,11 @@ class File extends Common
|
||||
$mime_type = $mime_detector->detectMimeTypeFromBuffer($file_data);
|
||||
$ext_name = array_search($mime_type, GeneratedExtensionToMimeTypeMap::MIME_TYPES_FOR_EXTENSIONS);
|
||||
|
||||
// jpe/jpeg 统一为更常见的 jpg
|
||||
if ($ext_name === 'jpe' || $ext_name === 'jpeg') {
|
||||
$ext_name = 'jpg';
|
||||
}
|
||||
|
||||
$public_file_path = '/temp_img/' . uniqid() . '.' . $ext_name;
|
||||
|
||||
$temp_file = App::getRootPath() . 'public' . $public_file_path;
|
||||
|
||||
Reference in New Issue
Block a user