Reputation: 867
Is there any way to validate the width and height of image when uploaded? using javascript of server side ? like jsp, aspx etc?
Upvotes: 0
Views: 617
Reputation: 223133
If you're using the Java platform, you can use ImageIO to read the image, then use getHeight
and getWidth
on the BufferedImage
returned from the read operation.
I admit this is quite a heavyweight approach, so I'm sure there is an even better approach. I just have to find it. :-P
As for .NET, I have no idea. :-)
Upvotes: 2
Reputation: 3344
I've done this by execing the Image Magick "identify" command.
Easy enough if you're using Unix - although I think it runs on Windows too.
I doubt you can do it client-side.
Upvotes: 0