title: How to Rotate image before displaying in web using JavaScript?
body: <p>I just want to know, can I detect attributes of an image before displaying it on the web? In my case, I have a thousand photos. I want to display them on my web page but some photos have a different orientation (like Landscape and Portrait).</p>
  
  <p>Can I detect the width and height of the image before it is displayed on my web page?</p>
  
  <p>Maybe using JavaScript like:</p>
  
  <pre><code>If height&gt;width than rotate
  else just display.
  </code></pre>
  
  <p>Is there any JavaScript function for doing that? Just for getting the attribute not displaying it. Is there a trick?</p>