{{- $image := .image -}} {{- $page := .page -}} {{- $src := $image -}} {{- $caption := "" -}} {{- $title := "" -}} {{- $alt := "" -}} {{- if reflect.IsMap $image -}} {{- $src = $image.src | default "" -}} {{- $caption = $image.caption | default "" -}} {{- $title = $image.title | default $caption | default "" | plainify -}} {{- $alt = $image.alt | default $title | default "" | plainify -}} {{- end -}} {{- if $src -}} {{- $isRemote := strings.HasPrefix $src "http" -}} {{- if $isRemote -}} {{- $remote := resources.GetRemote $src -}} {{- $image = resources.Copy (printf "static/3rd-party/%s" $remote.Name) $remote -}} {{- else -}} {{- $image = ($page.Resources.Get $src) | default (resources.Get $src) -}} {{- end -}} {{- end -}} {{- $result := "" -}} {{- with $image -}} {{- $full := . | images.Filter (images.Process "webp q90") -}} {{- $thumb := . -}} {{- if gt .Width 2000 -}} {{- $thumb = . | images.Filter (images.Process "resize 2000x webp q75") -}} {{- else -}} {{- $thumb = . | images.Filter (images.Process "webp q75") -}} {{- end -}} {{- $result = dict "full" $full "thumb" $thumb "caption" $caption "title" $title "alt" $alt -}} {{- end -}} {{- return $result -}}