Check image dimensions (height and width) before uploading image using PHP
We can do this with temp file easily.
$image_info = getimagesize($_FILES["file_field_name"]["tmp_name"]);$image_width = $image_info[0];$image_height = $image_info[1];
This is how I solved it.
$test = getimagesize('../bilder/' . $filnamn);$width = $test[0];$height = $test[1];if ($width > 1000 || $height > 1000){echo '<p>iamge is to big';unlink('../bilder/'.$filnamn);}
This work for me
$file = $_FILES["files"]['tmp_name'];list($width, $height) = getimagesize($file);if($width > "180" || $height > "70") { echo "Error : image size must be 180 x 70 pixels."; exit;}