29 lines
920 B
HTML
29 lines
920 B
HTML
{{- $image := .image -}}
|
|
{{- $showMeta := .showMeta -}}
|
|
{{- $forceCentered := .forceCentered -}}
|
|
{{- $alt := .alt -}}
|
|
{{- $title := .title -}}
|
|
{{- $display := $image -}}
|
|
|
|
{{- if ne $image.MediaType.SubType "svg" -}}
|
|
{{- if gt $image.Width $image.Height -}}
|
|
{{- $maxWidth := 1400 -}}
|
|
{{- if and $showMeta (not $forceCentered) -}}
|
|
{{- $maxWidth = 900 -}}
|
|
{{- end -}}
|
|
{{- $targetWidth := $image.Width -}}
|
|
{{- if gt $image.Width $maxWidth -}}
|
|
{{- $targetWidth = $maxWidth -}}
|
|
{{- end -}}
|
|
{{- $display = $image.Resize (printf "%dx webp q80" $targetWidth) -}}
|
|
{{- else -}}
|
|
{{- $targetHeight := $image.Height -}}
|
|
{{- if gt $image.Height 900 -}}
|
|
{{- $targetHeight = 900 -}}
|
|
{{- end -}}
|
|
{{- $display = $image.Resize (printf "x%d webp q80" $targetHeight) -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
<img src="{{ $display.RelPermalink }}" alt="{{ $alt }}" title="{{ $title }}">
|