{{- $image := .image -}} {{- $showMeta := .showMeta -}} {{- $forceCentered := .forceCentered -}} {{- $alt := .alt -}} {{- $title := .title -}} {{- $display := $image -}} {{- if ne $image.MediaType.SubType "svg" -}} {{- if gt $image.Width $image.Height -}} {{- $maxWidth := 1400 -}} {{- if and $showMeta (not $forceCentered) -}} {{- $maxWidth = 900 -}} {{- end -}} {{- $targetWidth := $image.Width -}} {{- if gt $image.Width $maxWidth -}} {{- $targetWidth = $maxWidth -}} {{- end -}} {{- $display = partial "media/process-image.html" (dict "image" $image "action" "Resize" "spec" (printf "%dx" $targetWidth) ) -}} {{- else -}} {{- $targetHeight := $image.Height -}} {{- if gt $image.Height 900 -}} {{- $targetHeight = 900 -}} {{- end -}} {{- $display = partial "media/process-image.html" (dict "image" $image "action" "Resize" "spec" (printf "x%d" $targetHeight) ) -}} {{- end -}} {{- end -}} {{ $alt }}