title: rotate image if needed with javascript
body: <p>I have a preview spot to show a preview of the image before uploading, the problem is when you  choose an image from your phone it appears sideways. How can I rotate the image if it needs to be rotated?</p>
  
  <p>my javascript to show the preview:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
   function readURL(input) {
              if (input.files &amp;&amp; input.files[0]) {
                  var reader = new FileReader();
  
                  reader.onload = function (e) {
                      $('#blah')
                          .attr('src', e.target.result)
  
                  };
  
                  reader.readAsDataURL(input.files[0]);
              }
          }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>and the html</p>
  
  <pre><code>&lt;img src="images/Your_Picture_Here.png" alt="" title="" class="prod_image" id = "blah"/&gt;
  </code></pre>