29 lines
970 B
JSON
Raw Normal View History

{{- $first := true -}}
{{- $filter := images.AutoOrient -}}
2024-10-24 13:07:53 +02:00
{{- $teaser := .Resources.GetMatch "thumbnail.jpg" -}}
2025-02-22 17:31:52 +01:00
{{- $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 }}",
2025-02-22 17:31:52 +01:00
"thumbnail": "{{ (.Fit $gallerySize).RelPermalink }}"
}
{{- end -}}
{{- end -}}
{{ end -}}