title: php image rotation not working as expected
body: <p>I am using php to rotate a photo on server. When I click a button 'rotate' I use ajax to load php page, perform rotation and refresh div with new image. </p>
  
  <p>Everything works and the image has been rotated with the correct dimensions but the image itself hasn't rotated. If i hit f5 to refresh page, the image is displayed corrected. Does anyone know why the image isn't displayed correctly before refreshing.</p>
  
  <pre><code>$photo_path= $result['photo_path'];
  $src = imagecreatefromjpeg($photo_path);
  $rotate = imagerotate($src, 90, 0);
  @unlink($photo_path);
  imagejpeg($rotate,$photo_path);
  imagedestroy($src);
  imagedestroy($rotate);
  </code></pre>
  
  <p>Any ideas?</p>