deresh/phpthumb — pull request #1 by nicolardi (2014-06-03 18:09:03+00:00)
Title: Fix in the case of JPEG with exif data saying that the image is rotated

I have a portrait image. What I did:

save("image_saved.jpg");
?>

The image was taken with a samsung s2 and it is portrait. The saved version is landscape instead.
I have investigated a bit and I have found that GD goes wrong if the "EXIF" data says if the Orientation is set. I have found a code that handles all the different values of the Orientation parameter. So I have wrote a fixOrientation method which is called from the "JPG" part in the __construct of GdThumb.inc.php

Now if the image is saved it stays portrait like it should be,
I did not test the code too much.

You should do some check I did not broke something somewhere else.

I try to attach the image which shows the problem here.

![image](https://cloud.githubusercontent.com/assets/570359/3164405/d63c118a-eb49-11e3-93af-1c515f1d897e.jpg)