Reputation: 229
Hi am a newbie to angular JS . I have been trying do something, I have a login form in which I have a file input type where user can upload his picture. The input field is like this
<input type="file" file-model="userPic"/>
So, in the controller.js file on submit of the form when I
console.log(userPic)
I get the file name, size, modified date . But I want to find the dimensions of the upload picture width and height before the form submit. I have also bower components installed I that I have jquery folder inside that I have dimensions.js file is that useful ?
I have also tried to console.log using .width().For that I changed the code a little bit
<input type="file" file-model="userPic" id="userId"/>
and in the controller.js file on form submit
console.log($('#userId').width());
I have tried this but the output I get is not correct . How would I proceed .
Upvotes: 1
Views: 808
Reputation: 6527
You'll want to use naturalWidth and naturalHeight:
$scope.userPic.naturalHeight();
$scope.userPic.naturalWidth();
Upvotes: 2