Mysql php-如何拒绝图像

Mysql php-如何拒绝图像,php,mysql,Php,Mysql,如果图像不符合预定大小的图像(使用mysql-php),我们如何拒绝该图像 如果用户上传图像并按下“提交”按钮,则仅保存与给定大小匹配的图像,但仅当图片与指定图像大小不匹配时,才会被拒绝。在php中,您将获得图像大小: 对于上载的图像: $image_info = getimagesize($_FILES["file_field_name"]["tmp_name"]); $image_width = $image_info[0]; $image_height = $image_info[1];

如果图像不符合预定大小的图像(使用mysql-php),我们如何拒绝该图像


如果用户上传图像并按下“提交”按钮,则仅保存与给定大小匹配的图像,但仅当图片与指定图像大小不匹配时,才会被拒绝。在php中,您将获得图像大小:

对于上载的图像:

$image_info = getimagesize($_FILES["file_field_name"]["tmp_name"]);
$image_width = $image_info[0];
$image_height = $image_info[1];

list($width,$height)=getimagesize(“上传的图像路径”);
回声“宽度:”$宽度。“
”; 回声“高度:”$高度;
将您的条件设置为“拒绝图像上载”的图像高度、宽度。

您可以使用此功能实现此目的:

<?php
$predefined_width = "100";
$predefined_height = "150";
list($width, $height) = getimagesize("myimg.jpg");
$w = $width;
$h = $height;

// at the time of upload image just check this if condition:

if($w == $predefined_width && $h == $predefined_height) {
// image upload code
}

?>

好吧。。。。。检查大小,如果不匹配,是否不保存图像?
<?php
$predefined_width = "100";
$predefined_height = "150";
list($width, $height) = getimagesize("myimg.jpg");
$w = $width;
$h = $height;

// at the time of upload image just check this if condition:

if($w == $predefined_width && $h == $predefined_height) {
// image upload code
}

?>