Wayniac Posted January 31, 2010 Share Posted January 31, 2010 Hey all! I'm having a hard time understanding how one retrieves an images width that is about to be uploaded? I am just trying to give it a simple error check to say "keep under 500 pixels". Below is an if statement I threw together. Nothing is spit out and it uploads normally, even if I upload an image larger then 500 pixels width. It must be something with it not being declared properly. if ($imageWidth > 500) { echo "Error: Image width must be 500 pixels or less."; exit(); } Link to comment https://forums.phpfreaks.com/topic/190435-max-width-error-check/ Share on other sites More sharing options...
jl5501 Posted January 31, 2010 Share Posted January 31, 2010 How are you getting the value for $imageWidth? Link to comment https://forums.phpfreaks.com/topic/190435-max-width-error-check/#findComment-1004541 Share on other sites More sharing options...
Wayniac Posted January 31, 2010 Author Share Posted January 31, 2010 Sorry, forgot to mention. This is what I would like to know. How would I get the actual image value so I can tell the user that they have to re-size it first before uploading. Link to comment https://forums.phpfreaks.com/topic/190435-max-width-error-check/#findComment-1004551 Share on other sites More sharing options...
jl5501 Posted January 31, 2010 Share Posted January 31, 2010 getimagesize() http://de.php.net/manual/en/function.getimagesize.php Link to comment https://forums.phpfreaks.com/topic/190435-max-width-error-check/#findComment-1004558 Share on other sites More sharing options...
Wayniac Posted January 31, 2010 Author Share Posted January 31, 2010 Thank you, works now Link to comment https://forums.phpfreaks.com/topic/190435-max-width-error-check/#findComment-1004764 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.