Skip to content

Commit

Permalink
If with or heght is set in img and figure shortcodes, use that even w…
Browse files Browse the repository at this point in the history
…hen size is set.
  • Loading branch information
frjo committed Nov 14, 2023
1 parent b69a268 commit fb411d6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions layouts/shortcodes/figure.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,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 -}}
Expand Down
9 changes: 7 additions & 2 deletions layouts/shortcodes/img.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}
Expand Down

0 comments on commit fb411d6

Please sign in to comment.