7 posts by 4 authors in: Forums > CMS Builder
Last Post: May 23, 2016   (RSS)

By csdesign - March 1, 2016


It appears I have run into the same problem as in this post: 


Here's one that's live on the site right now that's turned automatically: 

DETAIL PAGE - 1st and 3rd images


I've also attached the screenshot of the image upload area for the horse above (Picture 3.png). I saved the images to desktop from the page and they maintained the incorrect orientation so I created a test listing of my own:  I pulled for a few different resources (my own camera and images sent to me by email) and I got mixed results. The vertical image from my camera is in the wrong orientation but the two that were emailed to me came in correctly. 

My Test Listing Detail Page:  LAST ON page 2

I've attached the screenshot of the image upload area which show them exactly how the appear on the page (Picture 13.png)

They all show in the Image Upload "image preview" as being vertical (Picture 16.png) but yet upload as a horizontal in the cms software and upload to the server as a horizontal.  (with the exception of the one that had been edited before being emailed to me which is displaying as a vertical)

And... for good measure. I've also uploaded the vertical images via ftp to a test folder without opening them in photoshop or any other program:

http://www.codyhorsesale.com/images/test/IMG_7217.JPG  (completely unedited - directly from camera)
http://www.codyhorsesale.com/images/test/2013-08-01 001.JPG  (emailed)
http://www.codyhorsesale.com/images/test/IMG_6286.JPG  (completely unedited - directly from camera)

I'm assuming that clients can depend on the image preview to replicated on the page and not have to go to a another step or rotating the photo in some sort of imaging software - that most probably will not be familiar with. 

Your help would be greatly appreciated. 

Thanks! Tina

By Chris - March 1, 2016

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) {

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,

By csdesign - April 7, 2016

Will do! thanks so much for the reply!! 

By pixelMIGHT(Josh) - May 23, 2016

Hello. I am having the same problem with images. The culprit in this case is a Samsung S5. 

I did at one time have Interactive Tools create a plugin that added a Rotate button to the upload preview, but with Version 3 it doesn't work. Here are the errors: 

E_WARNING: include(): Failed opening 'lib/menus/default/uploadModify.php' for inclusion (include_path='/data/23/2/0/101/2652264/user/2911153/htdocs/BESnet/cms:/data/23/2/0/101/2652264/user/2911153/htdocs/BESnet/cms/3rdParty:.:/usr/share/php:/usr/services/vux/lib/php')

E_WARNING: include(lib/menus/default/uploadModify.php): failed to open stream: No such file or directory

E_WARNING: include(lib/menus/default/uploadModify.php): failed to open stream: No such file or directory

E_WARNING: require_once(lib/menus/default/uploadForm_functions.php): failed to open stream: No such file or directory

(Of course www.domain.com contains the actual domain.)

I saw in the documentation "To fix replace START_TIME with $_SERVER['REQUEST_TIME_FLOAT']" but I cannot find this line in any files.

Is there something in the custom plugin files I should change?

I can upload them here or send them to you if helpful. 

Thank you

By pixelMIGHT(Josh) - May 23, 2016

Also, I what Tina suggested above but I do get the Out of Memory warning. If that can be adjusted and images upload correctly, that is fine too. 

Either solution is fine with me, but preferably it would upload correctly to start. 


By Damon - May 23, 2016


Can you reply to the consulting email ticket from when you had the custom Rotate image plugin written?

Then we can review the code and get back to you with details.


Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.