{{ $params := . }} {{ $alt := $params.alt }} {{ $class := $params.class }} {{ $crossorigin := $params.crossorigin | default "anonymous" }} {{ $fetchpriority := $params.fetchpriority }} {{ $fingerprint := $params.fingerprint | default true }} {{ $height := $params.height }} {{ $loading := $params.loading | default "lazy" }} {{ $maxheight := $params.maxheight }} {{ $maxwidth := $params.maxwidth }} {{ $method := $params.method }} {{ $options := $params.options }} {{ $page := $params.page }} {{ $raw := $params.raw }} {{ $referrerpolicy := $params.referrerpolicy | default "no-referrer" }} {{ $resource := $params.resource }} {{ $src := $params.src }} {{ $style := $params.style }} {{ $title := $params.title }} {{ $width := $params.width }} {{ $intrinsicheight := $height }} {{ $intrinsicwidth := $width }} {{ if $raw }} {{ $src = relLangURL $src }} {{ else }} {{ if not $resource }} {{ $resource = partial "paige/resource.html" (dict "page" $page "url" $src ) }} {{ end }} {{ if and $method $options }} {{ if eq $method "crop" }} {{ $resource = $resource.Crop $options }} {{ else if eq $method "fill" }} {{ $resource = $resource.Fill $options }} {{ else if eq $method "fit" }} {{ $resource = $resource.Fit $options }} {{ else if eq $method "resize" }} {{ $resource = $resource.Resize $options }} {{ else }} {{ errorf "invalid method: %q" $method }} {{ end }} {{ end }} {{ $intrinsicheight = $resource.Height }} {{ $intrinsicwidth = $resource.Width }} {{ if $fingerprint }} {{ $resource = $resource | fingerprint }} {{ end }} {{ $src = $resource.RelPermalink }} {{ end }} {{ if and (or $height $maxheight) (not (or $maxwidth $width)) }} {{ $width = "auto" }} {{ end }} {{ if and (or $maxwidth $width) (not (or $height $maxheight)) }} {{ $height = "auto" }} {{ end }} {{ if $height }} {{ with printf "height: %v" $height }} {{ if $style }} {{ $style = printf "%v; %v" $style . }} {{ else }} {{ $style = . }} {{ end }} {{ end }} {{ end }} {{ if $maxheight }} {{ with printf "max-height: %v" $maxheight }} {{ if $style }} {{ $style = printf "%v; %v" $style . }} {{ else }} {{ $style = . }} {{ end }} {{ end }} {{ end }} {{ if $maxwidth }} {{ with printf "max-width: %v" $maxwidth }} {{ if $style }} {{ $style = printf "%v; %v" $style . }} {{ else }} {{ $style = . }} {{ end }} {{ end }} {{ end }} {{ if $width }} {{ with printf "width: %v" $width }} {{ if $style }} {{ $style = printf "%v; %v" $style . }} {{ else }} {{ $style = . }} {{ end }} {{ end }} {{ end }} {{ . }}