validating an image

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hame22
Forum Contributor
Posts: 214
Joined: Wed May 11, 2005 5:50 am

validating an image

Post by hame22 »

Hi

I have a form where users can submit an image which is uploaded to the web server.

I am trying to validate this image but am having some difficulties using the getimagesize() function (though this may not be the right way to go about this!)

I am first trying to validate whether the selected files is an image (at best a jpeg or a gif)

and then to validate the images dimensions - I can accept no images greater than 200px X 200px

I would really appricaTE it something could supply some advice as this problem is really bugging me!!

thanks in advance
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

Generally, getimagesize() is the best thing you can do - although it's not enough in my opinion.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

What kind of difficulties are you having?

Mac
Post Reply