{{- $source := ($.Page.Resources.ByType "image").GetMatch (printf "%s" (.Get "name")) }} {{- $customAlt := .Get "alt" }} {{- $customSize := .Get "size" | lower }} {{- $customAnchor := default "smart" (.Get "anchor") | title }} {{- $data := newScratch }} {{- with $source }} {{- $caption := default .Title $customAlt }} {{- $isSVG := (eq .MediaType.SubType "svg") }} {{- $origin := . -}} {{- if $isSVG }} {{- $data.SetInMap "size" "tiny" "160" }} {{- $data.SetInMap "size" "small" "300" }} {{- $data.SetInMap "size" "medium" "600" }} {{- $data.SetInMap "size" "large" "900" }} {{- else }} {{- $data.SetInMap "size" "tiny" (printf "160x160 %s" $customAnchor) }} {{- $data.SetInMap "size" "small" (printf "300x300 %s" $customAnchor) }} {{- $data.SetInMap "size" "medium" (printf "600x600 %s" $customAnchor) }} {{- $data.SetInMap "size" "large" (printf "900x900 %s" $customAnchor) }} {{- end -}}
{{- $size := $data.Get "size" }} {{- if not $isSVG }} {{- if ne $customSize "origin" }} {{- end }} {{- end }} {{ $caption }}
{{- end }}