Get thumbnails oriented the right way before resizing

This commit is contained in:
Eryn Wells 2022-10-25 17:37:46 -04:00
parent 397c2262be
commit 1200833ef3

View file

@ -1,10 +1,9 @@
{{- $thumbnailResource := .Resources.GetMatch (index .Params "thumbnail")
| default (index (.Resources.ByType "image") 0) -}}
{{- $thumbnail := $thumbnailResource.Fit "600x600" -}}
{{- $thumbnail := $thumbnail.Crop "600x600" -}}
{{- $orientation := partial "images/orientation_angle.html" $thumbnailResource -}}
{{- $thumbnail := $thumbnailResource.Fit (printf "%dx%d r%d" 600 600 (sub 360 $orientation)) -}}
{{- $thumbnail = $thumbnail.Crop "600x600" -}}
{{- $altText := $thumbnailResource.Params.alt -}}
<li>
<a href="{{ .RelPermalink }}" title="{{ .Title }}">
<img src="{{ $thumbnail.RelPermalink }}" {{ with $altText }}alt="{{ . }}"{{ end }}>
</a>
</li>
<a href="{{ .RelPermalink }}" title="{{ .Title }}">
<img src="{{ $thumbnail.RelPermalink }}" {{ with $altText }}alt="{{ . }}"{{ end }}>
</a>