Fix #3692: Rotate pictures based on metadata

Rotate the image based on the EXIF orientation flag when generating
thumbnails and samples.

Also fix the width and height to be calculated correctly for rotated
images. Vips gives us the unrotated width and height of the image; we
have to detect whether the image is rotated and swap the width and
height manually to correct them. For example, if an image with the
"Rotate 90 CW" flag is 100x500 before rotation, then after rotation it's
500x100. This should fix #4883 (Exif rotation breaks Javascript fit-to-window)

We also have to fix it so that regenerating a post updates the width and
height of the post, in the event that it's a rotated image.

Finally we set `image-orientation: from-image;` even though it's
probably not necessary.
This commit is contained in:
evazion
2021-09-22 10:52:17 -05:00
parent 9b6c429d4c
commit b378785582
7 changed files with 85 additions and 3 deletions

View File

@@ -159,6 +159,7 @@ div#c-posts {
.image-container {
margin: 1em 0 0.5em;
image-orientation: from-image;
&.danbirthday::before {
content: "";