fix: ErrorException is thrown if getimagesize() returns false

ErrorException
Trying to access array offset on value of type bool
This commit is contained in:
kenjis 2024-02-28 06:21:07 +09:00
parent 9894b92997
commit e60466dabc
No known key found for this signature in database
GPG Key ID: BD254878922AF198

View File

@ -242,7 +242,13 @@ class FileRules
$allowedHeight = $params[1] ?? 0;
// Get uploaded image size
$info = getimagesize($file->getTempName());
$info = getimagesize($file->getTempName());
if ($info === false) {
// Cannot get the image size.
return false;
}
$fileWidth = $info[0];
$fileHeight = $info[1];