{{- $image := .image -}}
{{- $alt := .alt | default "" -}}
{{- $class := .class | default "" -}}
{{- $pictureClass := .pictureClass | default "" -}}
{{- $sizes := .sizes | default "100vw" -}}
{{- $style := .style | default "" -}}
{{- $title := .title | default "" -}}
{{- $loading := .loading | default "lazy" -}}
{{- $widths := .widths | default (slice 711 1422 2133) -}}
{{- $images := slice -}}
{{- if and $image (reflect.IsImageResourceProcessable $image) -}}
{{- range $widths -}}
{{- $width := int . -}}
{{- if le $width $image.Width -}}
{{- $images = $images | append ($image.Resize (printf "%dx Lanczos" $width)) -}}
{{- end -}}
{{- end -}}
{{- if eq (len $images) 0 -}}
{{- $images = $images | append $image -}}
{{- end -}}
{{- $fallback := index $images 0 -}}
{{- $webpImages := slice -}}
{{- range $images -}}
{{- $webpImages = $webpImages | append (.Resize (printf "%dx webp Lanczos" .Width)) -}}
{{- end }}
{{- else if and $image (reflect.IsImageResourceWithMeta $image) -}}
{{- else if $image -}}
{{- end -}}