From bba6ecefcd84ba684a25e3cd1d399ad9e55ed967 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 21 Jul 2016 12:20:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BFile=E7=B1=BB=E7=9A=84checkIm?= =?UTF-8?q?g=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/File.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/library/think/File.php b/library/think/File.php index 54c2b138..21e8c9dd 100644 --- a/library/think/File.php +++ b/library/think/File.php @@ -195,11 +195,8 @@ class File extends SplFileObject { $extension = strtolower(pathinfo($this->getInfo('name'), PATHINFO_EXTENSION)); /* 对图像文件进行严格检测 */ - if (in_array($extension, array('gif', 'jpg', 'jpeg', 'bmp', 'png', 'swf'))) { - $imginfo = getimagesize($this->filename); - if (empty($imginfo) || ('gif' == $extension && empty($imginfo['bits']))) { - return false; - } + if (in_array($extension, ['gif', 'jpg', 'jpeg', 'bmp', 'png', 'swf']) && !in_array(exif_imagetype($this->filename), [1, 2, 3, 4, 6])) { + return false; } return true; }