Hi Tina,
Thanks for the example images, that made things very easy to test! I did some research and it seems like there aren't many cameras which rely on the EXIF Orientation tag rather than saving the image content with the correct rotation in the first place, which is why we haven't seen this issue come up often. The EXIF Orientation tag seems to be poorly-supported by many software systems, and unfortunately the PHP image processing functions we're relying on don't offer support for it.
I wrote a patch which will rotate affected uploaded images before they go through the complicated "resizeOversizedImages" step, but unfortunately it seems like this approach uses a lot of memory, so we can't enable this solution by default. We're going to try to come up with a better long-term solution that will work for everyone, but in the meantime, the next version of CMS Builder will include the following code in cmsb/lib/upload_functions.php:
// [experimental] rotate uploaded JPEG file if EXIF Orientation flag has been set
// explanation: certain cameras save rotated JPEG content and use a poorly-supported EXIF flag to tell users the image must be rotated (90, -90, or 180)
// our resampling code, which relies on GD, doesn't respect or preserve that flag, which can result in certain uploaded files being saved with incorrect rotation
// in testing, doing rotations like the following before resampling caused out-of-memory errors on reasonably large image files, so this fix has been disabled by default
$fixJpegExifOrientation = false; // defaulted to false to avoid potential out-of-memory errors
if ($fixJpegExifOrientation) {
_image_fixJpegExifOrientation($mainUploadWorkingPath);
}
Once you've upgraded to the next version of CMSB, (we should be releasing it for beta testing within the next couple days,) you can edit this file and change "false" to "true", which should fix rotation issues for you. Please make sure to test it by uploading a big image to make sure your server has enough memory to be able to rotate the image. If you get an "out of memory" error, let us know and we'll let you know what your options are.
All the best,
Chris