Hi!
You will have to check the value of the $photo.Exif.Tags.Orientation
to determine which way the photo needs to be rotated. The link provided by @b_rad shows how the values of the .Orientation
field relate to the spacial orientation of the image:
Using this, you can write a snippet that can rotate the image based on the .Oritientation
value:
{{ with $photo }}
{{ $orientation = .Exif.Tags.Orientation }}
{{ if eq $orientation 1 }}
// Do nothing, image is right-side up
{{ else if (eq $orientation 8) }}
// Rotate the image 90deg CCW (.Resize "r90")
... so on
{{ end }}
{{ end }}