* [bug#66835] Show supported image types in upload error message.

This commit is contained in:
liugang
2025-11-04 17:28:34 +08:00
parent 1ab55a3462
commit 17119e082f
3 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -268,7 +268,7 @@ $lang->user->error->errorEmail = 'The account does not match the email. Pl
$lang->user->error->emailSetting = 'No email is configured in the system. Contact the admin to reset the email.';
$lang->user->error->sendMailFail = 'Message sending failed, please try again!';
$lang->user->error->loginTimeoutTip = 'Login failed, please check if the proxy service is normal.';
$lang->user->error->uploadAvatar = "The upload of your profile picture was unsuccessful. Kindly ensure that you're uploading a file of the appropriate image type.";
$lang->user->error->uploadAvatar = 'Failed to upload avatar. Please upload an image in %s format.';
$lang->user->contactFieldList['phone'] = $lang->user->phone;
$lang->user->contactFieldList['mobile'] = $lang->user->mobile;
+1 -1
View File
@@ -268,7 +268,7 @@ $lang->user->error->errorEmail = '用户名和邮箱不匹配,请重新
$lang->user->error->emailSetting = '系统未配置发信邮箱,请联系管理员重置。';
$lang->user->error->sendMailFail = '邮件发送失败,请重试!';
$lang->user->error->loginTimeoutTip = '系统登录失败,请检查代理服务是否正常';
$lang->user->error->uploadAvatar = '上传头像失败,请上传图片类型的文件。';
$lang->user->error->uploadAvatar = '上传头像失败,请上传 %s 类型的图片。';
$lang->user->contactFieldList['phone'] = $lang->user->phone;
$lang->user->contactFieldList['mobile'] = $lang->user->mobile;
+2 -1
View File
@@ -1462,7 +1462,8 @@ class userModel extends model
$fileIdList = array_keys($uploadResult);
$file = $this->file->getByID(end($fileIdList));
if(!in_array($file->extension, array('jpg', 'jpeg', 'gif', 'png', 'bmp'))) return array('result' => 'fail', 'message' => $this->lang->user->error->uploadAvatar);
$imageExtensions = $this->config->file->imageExtensions;
if(!in_array($file->extension, $imageExtensions)) return array('result' => 'fail', 'message' => sprintf($this->lang->user->error->uploadAvatar, implode(', ', $imageExtensions)));
return array('result' => 'success', 'message' => '', 'fileID' => $file->id, 'locate' => helper::createLink('user', 'cropavatar', "image={$file->id}"));
}