mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
改进File类的checkImg方法
This commit is contained in:
@@ -195,11 +195,8 @@ class File extends SplFileObject
|
|||||||
{
|
{
|
||||||
$extension = strtolower(pathinfo($this->getInfo('name'), PATHINFO_EXTENSION));
|
$extension = strtolower(pathinfo($this->getInfo('name'), PATHINFO_EXTENSION));
|
||||||
/* 对图像文件进行严格检测 */
|
/* 对图像文件进行严格检测 */
|
||||||
if (in_array($extension, array('gif', 'jpg', 'jpeg', 'bmp', 'png', 'swf'))) {
|
if (in_array($extension, ['gif', 'jpg', 'jpeg', 'bmp', 'png', 'swf']) && !in_array(exif_imagetype($this->filename), [1, 2, 3, 4, 6])) {
|
||||||
$imginfo = getimagesize($this->filename);
|
return false;
|
||||||
if (empty($imginfo) || ('gif' == $extension && empty($imginfo['bits']))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user