2016-09-02 5 views
0

Angular js Bild hochladen, wie Breite und Höhe Beispiel myDD = 200 und Heidht = 200 wenn geben mehr als Pixel seine Show Fehler wie kann ich es, wenn ich etwas versuchen kann es lösenValidierung auf Bild Pixel

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 
      }); 
     } 
    } 
}; 

Antwort

Verwandte Themen