{{- $first := true -}} {{- $filter := images.AutoOrient -}} {{- $teaser := .Resources.GetMatch "thumbnail.jpg" -}} {{- $galleryHeight := 200 }} {{- with site.Params.galleryUseHeight }} {{- $galleryHeight = . | int }} {{- end }} {{- with .Page.Params.galleryUseHeight }} {{- $galleryHeight = . | int }} {{- end }} {{- $galleryWidth := mul $galleryHeight 1.5 | math.Round | int -}} {{- $gallerySize := printf "%dx%d" $galleryWidth $galleryHeight -}} {{- range .Resources.ByType "image" -}} {{- if not (eq $teaser .) -}} {{- if not $first }}, {{ end }} {{ $first = false -}} {{- with . | images.Filter $filter -}} { "title": "{{ .Title }}", "url": "{{ .RelPermalink }}", "width": "{{ .Width }}", "height": "{{ .Height }}", "thumbnail": "{{ (.Fit $gallerySize).RelPermalink }}" } {{- end -}} {{- end -}} {{ end -}}