Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rotate jpeg images by exif orientation #1110

raffaelj opened this issue May 13, 2019 · 0 comments


None yet
1 participant
Copy link

commented May 13, 2019

I think about the best way to rotate images by exif orientation by default. Doing so is easy with a change of one line, but it has some side effects.

Working test branch: raffaelj@4ec3e94

This issue was addressed before in #339 (2015).

SimpleImage already has a function autoOrient(), that doesn't do any harm if it is called for non-jpeg files or if the exif orientation is correct.


For images > 4MB I had to increase the memory_limit in php.ini from 128M to 256M. Calling /cockpit/utils/thumb_url?src=... directly worked with 128M, but the assets manager wasn't able to load the thumbnail.

The creation time for a thumbnail increases. I simply counted the seconds by hand (no real test, I know) and a 6.8MB file without rotation took around 2 seconds. A 4MB file with rotation took 3-4 seconds. That's OK for one file, but not for many images on run time/via api requests.


  1. A user can manually rotate images via assets manager - interesting feature, but it doesn't fix the automatic rotation
  2. Create thumbnails from a resized file and not from the original. This way, the hard processing runs once and all upcoming image requests use a scaled image - e. g. with a user definable value with a default of 1920px width and a quality of 100%.
  3. Don't save large images. Scale them down and use them as originals.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.