2

working on a upload image feature for my custom CMS.

I have completed the feature, but have an image when uploading images from mobile devices. Only tested on IOS so far but the issue is:

If the user selects to take a picture and does so in portrait, when the image is saved it is rotated -90 degrees.

It is however fine in landscape. After some research I have found that it uses the exif data from an image and looks at the rotation. Is there a way to ignore this information and keep the image as it was taken?

Using a class to upload images I found on GitHub called bulletproof:

https://github.com/samayo/bulletproof

The link to the actual class:

https://github.com/samayo/bulletproof/blob/master/src/bulletproof.php

And this is the upload part from that:

$moveUploadedFile = move_uploaded_file($fileToUpload["tmp_name"], $this->uploadDir . "/" . $newFileName);

Thanks, Craig.

samayo
  • 16,163
  • 12
  • 91
  • 106
Lovelock
  • 7,689
  • 19
  • 86
  • 186

1 Answers1

0

This PHP class doesn't apply any image rotation. A search for imagerotate() fails. So this is not PHP related and you might ensure that by testing the image upload from another, non-iOS client.

Then, you might want to find out, if iOS has a setting to send the native, unmodifed image or if you have to apply some "rotate"-correction on iOS-device side to get a correct rotation before sending. In other words: i believe the image is transformed on IOS device side, before the image is send.

iOS PNG Image rotated 90 degrees

iOS4 landscape photos sideways in e-mail

Community
  • 1
  • 1
Jens A. Koch
  • 39,862
  • 13
  • 113
  • 141