javascript get length of results in if clauses
<p>I want to get the length of results in if clauses where it is true and then write it in the input hidden element.</p>

<p>Code:</p>

<pre><code>&lt;script type="text/javascript"&gt;
$(document).ready(function(){   
  var imgs = document.getElementById("images").getElementsByTagName("img");
  var imgSrcs = [];

  for (var i = 0; i &lt; imgs.length; i++) {
         $('#loaderimg').html(imgSrcs += getImgSize(imgs[i].src));
  }

  function getImgSize(imgSrc){
      var newImg = new Image();
      newImg.src = imgSrc;
      var height = newImg.height;
      var width = newImg.width;
      p = $(newImg).ready(function(){
          return {width: newImg.width, height: newImg.height};
      });
      // return (p[0]['width']+" "+p[0]['height']);
      if(p[0]['width'] &gt;= 100){
         return ('&lt;img src="'+imgSrc+'" id="'+i+'" width="100" style="max-height:150px;"&gt;');
      }else{
        return ('');
      }
  } 
}); 
&lt;/script&gt;
</code></pre>
