title: jQuery: How to validate dimensions of images before upload?
body: <p>I have some problem with jquery. I found some solution to validate the size of an image before upload. It was posted also here:</p>
  
  <pre><code>$.validator.addMethod('filesize', function(value, element, param) {
      // param = size (in bytes) 
      // element = element to validate (&lt;input&gt;)
      // value = value of the element (filename)
      return this.optional(element) || (element.files[0].size &lt;= param) 
  });
  </code></pre>
  
  <p>I defined everything and it works perfectly! But i also would like to validate the width and height of that image. I tried to add a second method which is the same like above but instead of size I used height or width but this doesnt work:</p>
  
  <pre><code>$.validator.addMethod('widthpic', function(value, element, param) {
     return this.optional(element) || (element.files[0].width == param) 
  });
  </code></pre>
  
  <p>Is there any solution for this? Of course i also checked the size of the image in PHP but I would like to add that also in jquery-style.</p>