title: Image getting rotated automatically on upload
body: <p>I'm trying to upload a base64 encoded image and save after decoding it. Image is getting uploaded and saved, and I can access it using a URL and everything..but the image gets rotated by 90 degrees anti-clockwise and I have no idea WHY!!</p>
  
  <p>The place where I get the encoded data is fine, as putting it in <code>&lt;img /&gt;</code> works fine!</p>
  
  <pre><code>function saveImageData($base64Data) {
      $base64_decoded = base64_decode($base64Data);
      $im = imagecreatefromstring($base64_decoded);
      if ($im !== false) {
          $imagepath = '/public/uploads/' . time() . '.jpg';
          imagejpeg($im, $imagepath);
          chmod($imagepath, 0755);
          imagedestroy($im);
      } else {
          return false;
      }
      return $imagepath;
  }
  </code></pre>
  
  <p>I'm not using any rotation functions, but still its getting rotated. I can use a PHP GD function like imagerotate, but don't want to for reasons like black backgrounds etc.</p>
  
  <p>If you can help..you r the awesomest person!!</p>