I need to check dimensions of image before upload. I have created a function in javascript for validation as follows
$('#destSubmit').click(function() {
var img = document.getElementById('destImage');
var width = img.naturalWidth ;
var height = img.naturalHeight ;
console.log('width : ' + width + '|| Height : ' + height);
if(height != 100 || width != 100){
alert(error);
}
}
But it shows width and height as undefined
;
I know this is a repeated question, but I cannot find a solution after a long research. Tried the solution listed here How to get image size (height & width) using JavaScript?, but no use.