Image resizing with php exif orientation

I have been working on a project recently that has incorporated an upload mechanic for images uploaded to our website. The images are then resiged and flipped into a different dimension when i used in  ipad. To solve this problem i found EXIF.

EXIF is a way of reading an image and returning the information determining the exact orientation of an image, what device the image was taken on etc..

The below code is the function I used in order to create my images to fit into a particular dimension.


The switch statement is used to look at a particular EXIF orientation and perform the required processing before the image is written to its destination. To flip the image we just use the function below.

Now all we need to do is call the function by passing a dimension that we want the image to fit into, the source and destination and also the file type of the source image.


2,592 total views, 1 views today

Share this OnShare on FacebookTweet about this on TwitterShare on LinkedInShare on Google+

Leave a Reply