How can I check the width and height of an image upload in AngularJS? For example, if the width is greater than 200 pixels and the height is greater than 200 pixels, it should show an error. How can I achieve this using AngularJS?
HTML
<div class="form-group">
<label class="col-sm-2 control-label">Logo :</label>
<div class="col-sm-4">
<input filestyle="" type="file" name="file" required="" ng-model="form.logo" onchange="angular.element(this).scope().add(this.files).checkPhoto(this)" accept="image/jpeg,image/jpg" data-classbutton="btn btn-default" data-classinput="form-control inline" class="form-control" />
<br><label Style="color: Red;">Logo should be in (550 X 150) size</label>
</div>
</div>
JS
$scope.fileList1 = [];
$scope.add1 = function(file1) {
console.log(file1);
for (var i = 0; i < file1.length; i++) {
if (file1[i].type == 'image/jpeg' || file1[i].type == 'image/jpg' || file1[i].type == 'image/tif' || file1[i].type == 'image/tiff') {
var item = {
name: file1[i].name,
file: file1[i]
};
$scope.fileList1.push(item);
var f = file1[i],
r = new FileReader();
console.log($scope.fileList1);
r.onloadend = function(e) {
}
r.readAsDataURL(f);
} else {
$('#file1').val('');
Notify.alert('Upload only .jpeg,jpg,tiff,tif format file', {
status: 'warning',
pos: 'top-right',
timeout: 3000
});
}
}
};