{{ $maxwidth := .Site.Params.imageMaxWidth -}} {{ $realwidth := 0 -}} {{ $realheight := 0 -}} {{ $width := 0 -}} {{ $height := 0 -}} {{ $height := 0 -}} {{ if (fileExists (add "/static" (.Get "src"))) -}} {{ with (imageConfig (add "/static" (.Get "src"))) -}} {{ $realwidth = .Width -}} {{ $realheight = .Height -}} {{ $width = .Width -}} {{ $height = .Height -}} {{ end -}} {{ end -}} {{ if and (.Get "width") (.Get "height") -}} {{ $width = (int (.Get "width")) -}} {{ $height = (int (.Get "height")) -}} {{ else if (.Get "width") -}} {{ $width = (int (.Get "width")) -}} {{ if and ($realwidth) (lt ($width) ($realwidth)) -}} {{ $height = (mul ($realheight) (div (add ($width) 0.0) ($realwidth))) -}} {{ $height = (math.Round $height) -}} {{ end -}} {{ else if (.Get "height") -}} {{ $height = (int (.Get "height")) -}} {{ if and ($realheight) (lt ($height) ($realheight)) -}} {{ $width = (mul ($realwidth) (div (add ($height) 0.0) ($realheight))) -}} {{ $width = (math.Round $width) -}} {{ end -}} {{ else if and ($maxwidth) (lt ($maxwidth) ($width)) -}} {{ $width = ($maxwidth) -}} {{ $height = (mul ($realheight) (div (add ($width) 0.0) ($realwidth))) -}} {{ $height = (math.Round $height) -}} {{ end -}}
{{ with .Get "link" }}{{ end -}} {{- if .Get "link" }}{{ end }} {{ if or (or (.Get "title") (.Get "caption" | markdownify)) (.Get "attr") -}}
{{ if isset .Params "title" }}

{{ .Get "title" }}

{{ end }} {{ if or (.Get "caption") (.Get "attr") -}}

{{- .Get "caption" -}} {{ with .Get "attrlink" }}{{ end }}{{ .Get "attr" | markdownify }}{{ if .Get "attrlink" }}{{ end -}}

{{ end -}}
{{ end -}}