Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.79 KB | None | 0 0
  1.  
  2.         $.validator.addMethod("data-rule-imageFacebookResolution", function (value, elem, attrValue) {
  3.             var _URL = window.URL;
  4.                 var file, img;
  5.                 if ((file = elem.files[0])) {
  6.                     img = new Image();
  7.                     img.onload = function () {
  8.                         alert("Width:" + this.width + "   Height: " + this.height);
  9.  
  10.                         if (this.width < 520 && this.height < 290) {
  11.                             return false;
  12.                         } else {
  13.                             return true;
  14.                         }
  15.                      
  16.                     };
  17.                     img.src = _URL.createObjectURL(file);
  18.             }
  19.             return false;
  20.         }, "@Strings.Shared_ImageResolutionError");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement