From 77076ac2e58c2780c1e571e65432a4659411c31a Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Sun, 17 Dec 2023 09:30:26 -0800 Subject: [PATCH] Add AutoOrient filter to img shortcode --- layouts/shortcodes/img.html | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/layouts/shortcodes/img.html b/layouts/shortcodes/img.html index b1b5a77a5e1..50d4da9edba 100644 --- a/layouts/shortcodes/img.html +++ b/layouts/shortcodes/img.html @@ -119,9 +119,10 @@ {{- end }} {{- $validFilters := slice - "brightness" "colorbalance" "colorize" "contrast" "gamma" "gaussianblur" - "grayscale" "hue" "invert" "none" "opacity" "overlay" "padding" "pixelate" - "process" "saturation" "sepia" "sigmoid" "text" "unsharpmask" + "autoorient" "brightness" "colorbalance" "colorize" "contrast" "gamma" + "gaussianblur" "grayscale" "hue" "invert" "none" "opacity" "overlay" + "padding" "pixelate" "process" "saturation" "sepia" "sigmoid" "text" + "unsharpmask" }} {{- with $filter }} @@ -157,7 +158,11 @@ {{- /* Create filter. */}} {{- $f := "" }} {{- $ctx := dict "filter" $filter "args" $filterArgs "name" .Name "position" .Position }} -{{- if eq $filter "brightness" }} +{{- if eq $filter "autoorient" }} + {{- $ctx = merge $ctx (dict "argsRequired" 0) }} + {{- template "validate-arg-count" $ctx }} + {{- $f = images.AutoOrient }} +{{- else if eq $filter "brightness" }} {{- $ctx = merge $ctx (dict "argsRequired" 1) }} {{- template "validate-arg-count" $ctx }} {{- $filterArgs = apply $filterArgs "float" "." }}