From 57fc8985a93f600d279690745d6614b9b751dff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=99=E8=BF=B0=E3=80=81=E5=88=AB=E7=A6=BB?= <93301500+xushubieli@users.noreply.github.com> Date: Fri, 28 Apr 2023 14:12:22 +0800 Subject: [PATCH] Update api.php --- src/user/api.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/user/api.php b/src/user/api.php index 4cee41ca..a96740bc 100755 --- a/src/user/api.php +++ b/src/user/api.php @@ -98,7 +98,6 @@ if ($action === 'is_need_check_code') { )); exit; } - $ff = isset($_FILES['file'])? $_FILES['file'] : $_FILES['imgfile']; $uploadedFile = $ff['tmp_name']; $fileType = mime_content_type($uploadedFile); @@ -131,9 +130,9 @@ if ($action === 'is_need_check_code') { MkdirAll($cfg_basedir.$cfg_user_dir."/{$cfg_ml->M_ID}", $cfg_dir_purview); CloseFtp(); } + //头像特殊处理 if ($type === "face") { - //头像特殊处理 - $target_file = $cfg_basedir.$cfg_user_dir."/{$cfg_ml->M_ID}/newface.png";//上传文件名 + $target_file = $cfg_basedir.$cfg_user_dir."/{$cfg_ml->M_ID}/newface.png"; $target_url = $cfg_mediasurl.'/userup'."/{$cfg_ml->M_ID}/newface.png"; } else { $nowtme = time(); @@ -152,12 +151,11 @@ if ($action === 'is_need_check_code') { } } $rkey = $ck == 1? "url" : "data"; - if (move_uploaded_file($ff["tmp_name"], $target_file)) { if ($mediatype === 1) { //图片自动裁剪 require_once DEDEINC."/libraries/imageresize.class.php"; - try{ + try { $image = new ImageResize($target_file); if ($type === "face") { $image->crop(150, 150);