nicokaiser / hugo-theme-gallery

Gallery Theme for Hugo
https://nicokaiser.github.io/hugo-theme-gallery/
MIT License
305 stars 85 forks source link

Use images.AutoOrient filter #51

Closed nicokaiser closed 5 months ago

nicokaiser commented 5 months ago

Instead of trying to calculate the image orientation, use the new images.AutoOrient filter from Hugo 0.121.2. https://gohugo.io/functions/images/autoorient/

-       {{ $thumbnail := ($image.Fit (printf "%s %s" "600x600" .rotation)) }}
-       {{ $full := ($image.Fit (printf "%s %s" "1600x1600" .rotation)) }}
+       {{ $thumbnail := $image.Fit "600x600" | images.Filter images.AutoOrient }}
+       {{ $full := $image.Fit "1600x1600" | images.Filter images.AutoOrient }}
nicokaiser commented 5 months ago

This would require to bump the minimal Hugo version.

nicokaiser commented 5 months ago

Fixed in v4.0.2