Images rotate automatically

I have an iPhone app that uploads photos to my server. One of the main problems that I have is rotating.

For some reason, if I upload a picture from my iPhone, some pictures will automatically rotate. Rotating are those that are in portrait mode. I don't have code in my script that rotates images.

How does the server accurately process tall images? Should I change my php file to check its rotation after it is automatically rotated? Should I encode something in my iPhone app that will verify this?

Any help is appreciated!

PS: If you need a code, feel free to ask!

+4
source share
2 answers

Some images (jpg) have exif data indicating the position of the camera when taking the image.

Take a look at http://www.php.net/manual/en/function.exif-read-data.php#76964

You can rotate server side images like this.

+6
source

Or is it better to use this library

https://github.com/Intervention/image

And just use it like this -

$img = Image::make('foo.jpg')->orientate(); 

More details can be found here .

0
source

Source: https://habr.com/ru/post/1345992/


All Articles