{{- $max_width := .Page.Params.image_max_width }} {{- $caption := .Inner }} {{- $file := .Params.file }} {{- $class := .Params.class }} {{- $source := .Params.source }} {{- $alt := .Params.alt }} {{- $dir := .Page.Params.image_dir }} {{- $path := printf "%s/%s" $dir $file}} {{- $img := resources.Get $path }} {{- $raw_width := $img.Width}} {{- $final1x_width := (cond (gt $max_width $raw_width) $raw_width $max_width) }} {{ if .Params.forced_width }} {{ $final1x_width = cast.ToInt .Params.forced_width }} {{ end }} {{- $final2x_width := math.Mul $final1x_width 2}} {{ $ext := "jpg" }} {{ if eq .Params.transparency "yes" }} {{ $ext = "png" }} {{ end }} {{- $img1xproc := printf "%dx %s q90" $final1x_width $ext }} {{- $img2xproc := printf "%dx %s q90" $final2x_width $ext }} {{- $img1x := $img.Resize $img1xproc }} {{- $img2x := $img.Resize $img2xproc }} {{- $imgproc := printf "x%d jpg q90" $raw_width }} {{- $img_raw := $img.Resize $imgproc }}
{{ $alt }} {{ if not (strings.Contains $caption "noop") }}
{{ $caption }} {{- if $source }} [source] {{ end }}
{{ end }}