title: Check aspect ratio of img via Javascript
body: <p>I've been asking a css viable solution in <a href="https://stackoverflow.com/questions/13105556/how-to-center-images-in-a-responsive-grid-with-css-only-and-supporting-retina-di">this question</a> for a responsive photo gallery with images of different ratios.<br>
  Unfortunately i guess it's too complicated to do this via css, so the only fast-easy solution is to use javascript to check the thumbnails aspect ratio and change the css inline for certain thumbs:<br>
  the script should check the <code>height:width</code> ratio of every thumbnail, if the ratio is lower than 0.6666666666666667 (2:3) then set via css <code>height:100%; max-width:none;</code> to override the actual rules. Can also be added a class, if easier.</p>
  
  <p>How can this be done via javascript? (jquery can be used too as the library is already present for other plugins). </p>
  
  <p>The structure of the grid is like this:</p>
  
  <pre><code>&lt;ul id="gallery" class="gallery-grid"&gt;
    &lt;li class="grid-block"&gt;
      &lt;div class="block-wrap"&gt;
          &lt;div class="link-wrap"&gt;
              &lt;a href="&lt;?php echo $photo-&gt;sourceImageFilePath; ?&gt;" class="block-link" target="_blank" &gt;
                  &lt;img class="block-thumb" src="&lt;?php echo $photo-&gt;thumbImageFilePath; ?&gt;"/&gt;              
              &lt;/a&gt;
          &lt;/div&gt;  
      &lt;/div&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>Ofcourse if you can find a viable css answer to my previous question is even more welcome! thanks!</p>