fix(web/image_hosting): image size calc
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2022-10-13 20:54:47 +08:00
parent 0ecf295a38
commit 2e51c20d9f
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

View File

@ -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');
}