If with or heght is set in img and figure shortcodes, use that even when size is set.

This commit is contained in:
Fredrik Jonsson 2023-11-14 11:54:52 +01:00
commit fb411d6f32

View file

@ -35,8 +35,13 @@
{{ if $size -}}
{{ $image := $resource.Resize $size -}}
{{ $src = $image.RelPermalink -}}
{{ $width = $image.Width -}}
{{ $height = $image.Height -}}
{{ if or $width $height -}}
{{ $realwidth = $image.Width -}}
{{ $realheight = $image.Height -}}
{{ else -}}
{{ $width = $image.Width -}}
{{ $height = $image.Height -}}
{{ end -}}
{{ if $srcset -}}
{{ $srcsetw = $srcsetw | append (printf "%s %sw" $src (strings.TrimRight "x" $size)) -}}
{{ end -}}