{{- $image := resources.GetMatch (.Get "src") -}} {{- $alt := .Get "alt" | default "" -}} {{- $caption := .Get "caption" | default "" -}} {{- $rotation := .Get "rotation" | default 0 -}} {{- $quality := .Get "quality" | default "original" -}} {{- $q := 0 -}} {{- $size := 0 -}} {{- if eq $quality "low" -}} {{- $q = 60 -}} {{- $size = 600 -}} {{- else if eq $quality "medium" -}} {{- $q = 75 -}} {{- $size = 1000 -}} {{- else if eq $quality "high" -}} {{- $q = 90 -}} {{- $size = 1200 -}} {{- end -}} {{- if ne $quality "original" -}} {{- $image = $image.Resize (printf "%dx q%d r%d" $size $q $rotation) -}} {{- end -}}
{{ $alt }} {{- if ne $caption "" -}}
{{ $caption }}
{{- end -}}