How to detect shot angle of photo, and auto rotate for website display like desktop apps do on viewing?

Viewed 30407

If I take a photo with a camera it stores the orientation/angle of the apparatus so when I view the image on the PC with a good app, it shows auto-rotated to 0.

But when I upload to a website it shows the original angle, so the image doesn't look good.

How can I detect this with PHP and rotate the image, and clear this angle flag from it's meta information.

4 Answers
Related