From 2e51c20d9fe35f8e955f500baed96b0c0bdba35d Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Thu, 13 Oct 2022 20:54:47 +0800 Subject: [PATCH] fix(web/image_hosting): image size calc --- web/app/controllers/image_hosting/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/app/controllers/image_hosting/index.php b/web/app/controllers/image_hosting/index.php index c450db5..3b87372 100644 --- a/web/app/controllers/image_hosting/index.php +++ b/web/app/controllers/image_hosting/index.php @@ -22,7 +22,7 @@ die(json_encode(['status' => 'error', 'message' => $msg])); } - $allowedTypes = [IMAGETYPE_PNG, IMAGETYPE_JPEG, IMAGETYPE_GIF]; + $allowedTypes = [IMAGETYPE_PNG, IMAGETYPE_JPEG]; if ($_POST['image_upload_file_submit'] == 'submit') { header('Content-Type: application/json'); @@ -81,7 +81,7 @@ imagepng($img, $_FILES["image_upload_file"]["tmp_name"]); imagedestroy($img); - if (filesize($_FILES["image_upload_file"]["tmp_name"]) > 5242880) { // 5 MB + if (($size = filesize($_FILES["image_upload_file"]["tmp_name"])) > 5242880) { // 5 MB throwError('too_large'); }