Limiting File Upload Size by Image Height/Width

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
Jim
Forum Contributor
Posts: 238
Joined: Fri Apr 19, 2002 5:26 am
Location: Near Austin, Texas

Limiting File Upload Size by Image Height/Width

Post by Jim »

Is it possible to limit an image upload by height/width?

Thanks!
User avatar
Wayne
Forum Contributor
Posts: 339
Joined: Wed Jun 05, 2002 10:59 am

Post by Wayne »

you will have to let the file upload then check the image properties using the GD library functions if you have that functionality on your server check out the entry for

GetImageSize()

then decide whether to save it or reject it.
User avatar
liljester
Forum Contributor
Posts: 400
Joined: Tue May 20, 2003 4:49 pm

Post by liljester »

it is totally possible. i have a script that checks image size, and resizes the image if its too big. however mine will only accept jpg and png files. check out the Image Functions on php.net. also you must have a GD library installed.
Post Reply