altezza max immagine + gestione caso portrait

This commit is contained in:
Paolo Asperti 2024-07-17 23:34:00 +02:00
parent 848dd5ebe0
commit f8d18536e7
Signed by: paspo
GPG Key ID: 06D46905D19D5182

View File

@ -26,10 +26,12 @@
<span class="image featured">
{{- if in $rasters $img.MediaType.SubType -}}
{{- $img = $img.Resize (printf "x%d" $maxHeight) -}}
<img src="{{ $img.RelPermalink }}" alt="{{ .Params.image_alt }}" style="max-height: {{ $maxHeight }}px;" />
{{- if gt $img.Height $maxHeight -}}
{{- $img = $img.Resize (printf "x%d webp q50" $maxHeight) -}}
{{- end -}}
<img src="{{ $img.RelPermalink }}" alt="{{ .Params.image_alt }}" {{- if gt $img.Height $img.Width -}}style="width: auto;"{{- end -}} />
{{ else }}
<img src="{{ $img.RelPermalink }}" alt="{{ .Params.image_alt }}" style="max-height: {{ $maxHeight }}px;" />
<img src="{{ $img.RelPermalink }}" alt="{{ .Params.image_alt }}" />
{{ end }}
</span>
{{ end }}