mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
改进验证类的image方法
This commit is contained in:
@@ -723,19 +723,24 @@ class Validate
|
|||||||
if (!($file instanceof File)) {
|
if (!($file instanceof File)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$rule = explode(',', $rule);
|
if ($rule) {
|
||||||
list($width, $height, $type) = getimagesize($file->getRealPath());
|
$rule = explode(',', $rule);
|
||||||
if (isset($rule[2])) {
|
list($width, $height, $type) = getimagesize($file->getRealPath());
|
||||||
$imageType = strtolower($rule[2]);
|
if (isset($rule[2])) {
|
||||||
if ('jpeg' == $imageType) {
|
$imageType = strtolower($rule[2]);
|
||||||
$imageType = 'jpg';
|
if ('jpeg' == $imageType) {
|
||||||
}
|
$imageType = 'jpg';
|
||||||
if (image_type_to_extension($type, false) != $imageType) {
|
}
|
||||||
return false;
|
if (image_type_to_extension($type, false) != $imageType) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list($w, $h) = $rule;
|
||||||
|
return $w == $width && $h == $height;
|
||||||
|
} else {
|
||||||
|
return in_array($this->getImageType($file->getRealPath()), [1, 2, 3, 6]);
|
||||||
}
|
}
|
||||||
list($w, $h) = $rule;
|
|
||||||
return $w == $width && $h == $height;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user