18 lines
533 B
HTML
18 lines
533 B
HTML
{{ $orientation := 0 }}
|
|
|
|
{{ with (int .Exif.Tags.Orientation) }}
|
|
{{/* EXIF orientation is specified as an integer corresponding to a 90º rotation. */}}
|
|
{{ if in (slice 1 2) . }}
|
|
{{ $orientation = 0 }}
|
|
{{ else if in (slice 3 4) . }}
|
|
{{ $orientation = 180 }}
|
|
{{ else if in (slice 5 6) . }}
|
|
{{ $orientation = 90 }}
|
|
{{ else if in (slice 7 8) . }}
|
|
{{ $orientation = 270 }}
|
|
{{ end }}
|
|
{{ else }}
|
|
{{ warnf "Image missing orientation: %s" . }}
|
|
{{ end }}
|
|
|
|
{{ return $orientation }}
|