内核更新

This commit is contained in:
2016-07-22 14:33:13 +08:00
parent 265a9da552
commit c4ba53fd9e
10 changed files with 80 additions and 44 deletions

View File

@@ -195,12 +195,23 @@ class File extends SplFileObject
{
$extension = strtolower(pathinfo($this->getInfo('name'), PATHINFO_EXTENSION));
/* 对图像文件进行严格检测 */
if (in_array($extension, ['gif', 'jpg', 'jpeg', 'bmp', 'png', 'swf']) && !in_array(exif_imagetype($this->filename), [1, 2, 3, 4, 6])) {
if (in_array($extension, ['gif', 'jpg', 'jpeg', 'bmp', 'png', 'swf']) && !in_array($this->getImageType($this->filename), [1, 2, 3, 4, 6])) {
return false;
}
return true;
}
// 判断图像类型
protected function getImageType($image)
{
if (function_exists('exif_imagetype')) {
return exif_imagetype($image);
} else {
$info = getimagesize($image);
return $info[2];
}
}
/**
* 检测上传文件大小
* @param integer $size 最大大小