Forum Moderators: coopster
Im having trouble getting this to work, i want to validate that the uploaded image ($picture) is a gif or jpeg.
[php]
// Validate the image type. Should be jpeg, jpg, or gif.
$allowed = array ('image/gif', 'image/jpeg', 'image/jpg');
if (in_array($_FILES['picture']['type'], $allowed))
{
$errors['picture2'] = 'Please ensure the image is a JPEG or GIF.';
}
[/php]
Can anyone possibly help?
This one wont validate true for a 120wide x 90high image?
// Get image width and height and mime type
$image = getimagesize("$picture");
$type = $image['mime'];
$width = $image[0];
$height = $image[1];
// Validate the pictures dimensions (length & width set in config file)
if(($image[0] > $max_width) ¦¦ ($image[1] >$max_height)) {
$errors['picturedimensions'] = "Your image must not exceed ". $max_height . " x ". $max_width .".";
}