mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 23:02:48 +08:00
改进文件上传的非法图像异常
This commit is contained in:
@@ -242,8 +242,12 @@ class File extends SplFileObject
|
|||||||
if (function_exists('exif_imagetype')) {
|
if (function_exists('exif_imagetype')) {
|
||||||
return exif_imagetype($image);
|
return exif_imagetype($image);
|
||||||
} else {
|
} else {
|
||||||
$info = getimagesize($image);
|
try {
|
||||||
return $info[2];
|
$info = getimagesize($image);
|
||||||
|
return $info ? $info[2] : false;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -633,8 +633,12 @@ class Validate
|
|||||||
if (function_exists('exif_imagetype')) {
|
if (function_exists('exif_imagetype')) {
|
||||||
return exif_imagetype($image);
|
return exif_imagetype($image);
|
||||||
} else {
|
} else {
|
||||||
$info = getimagesize($image);
|
try {
|
||||||
return $info[2];
|
$info = getimagesize($image);
|
||||||
|
return $info ? $info[2] : false;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user