Hi Friends, I want the code for to limit the height and width at the time of image upload(110 X 110) if the image is greater than the 110 X 110 it will return false and show an alert (image is big) or the image sizes can be reduced to 110 X 110 across what the original size. Thanks in advance....
You can try something like this var img = new Image(); img.onload = function() { alert(this.width + 'x' + this.height); } img.src = 'http://www.google.com/intl/en_ALL/images/logo.gif'; Code (markup):
I can provide you the inputs, you need to work on that. Spoon-feeding won't help you in learning anything. You can use the html input tag to open a file chooser dialog <input type="file" id="fChooser"> Code (markup): You can get the image using the following //Firefox document.getElementById('fChooser').value //other browser document.getElementById('fChooser').files.item(0).getAsDataURL(); Code (markup): You can then use the logic i have posted previously.
Or you can limit the file size using the solution in below link http://stackoverflow.com/questions/3717793/javascript-file-upload-size-validation