checking the aspect ratio of an images
| From: | blueboy | Date: | Wed, 06 Jun 2007 10:41:19 +0000 |
| Subject: | checking the aspect ratio of an images | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-256160@lists.php.net to get a copy of this message | ||
I want to force users to insert landscape rather portrait images. I don't
want to be too pedantic about it but they do need to have an approximate 4x3
aspect ratio.
This is my code so far.
$max_height = "500"; // This is in pixels
$max_width = "500"; // This is in pixels
list($width, $height, $type, $w) =
getimagesize($_FILES['userfile']['tmp_name']);
if($width > $max_width || $height > $max_height)
{
}