title: Resizing image base on the longest side
body: <p>I'm trying to find a method to re-size image (.jpg) file base on the longest side. Images taken vertically and horizontally will have different longest side, I'm trying to fit them into a size-fixed div (inline-block). If I control only width or length, they will not be in scale (squashed).</p>
  
  <p>I have read "<a href="https://stackoverflow.com/questions/2446812/css-equivalent-of-the-if-statement">CSS Equivalent of the “if” statement</a>", it seems that there is a similar/possible method I can go about... finding which is the longest side (width OR height) and then adding 2 css for that.</p>
  
  <p>Perhaps something along the lines below?
  (Page is HTML based)</p>
  
  <p>CSS</p>
  
  <pre><code>img.thumb { identify longest side} //not quite sure how to go about this
  
  img.thumb width {
    width:200px;
    height:auto;
    border:0px;
  }
  
  img.thumb height{
    width:auto;
    height:200px;
    border:0px;
  }
  </code></pre>
  
  <p>I would prefer not to, but do I need to use JQuery instead (e.g. find image width and length, if width > length then add "width" to class)</p>