Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Prevent rotating images

Started by Muut Archive 10 years ago · 4 replies · 546 views
10 years ago

Some of the uploaded images/photo's are (unwanted) rotated, when displayed on a page.

I couldn't find the 'reason' for this, so i'm unaware of a way of preventing this behavior.
Didn't find info about this here http://learn.getgrav.org/content/media

Does anyone know why this happens, and how to prevent this from happening ?

10 years ago

They added a "fixOrientation" function in v1.0.8, which reads the exif data of your image. So if your camera have added an orientation flag inside an image, Grav tries to correct the orientation.

10 years ago

Usually happens with images taken with cameras and devices that do not actually rotate the image, but save the rotation information in the EXIF image data.

The solution currently is to use |fixOrientation in the Twig (or ?fixOrientation in the Markdown of the page (example: ![](Portrait_1.jpg?fixOrientation)).

I have a pending PR to automatically apply this orientation fix on all images, but that unfortunately there is a bug on the library we use for images, and until my fix for that library is applied (https://github.com/Gregwar/Image/pull/109), we cannot add a fix to Grav.

10 years ago

Thanks,
That works great.
Solves a huge problem..

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1354 9 years ago
Archive · by Muut Archive, 9 years ago
2 935 9 years ago
Archive · by Muut Archive, 9 years ago
2 4065 9 years ago
Archive · by Muut Archive, 9 years ago
1 2953 9 years ago
Archive · by Muut Archive, 9 years ago
3 1119 9 years ago