render-image.html (2368B)
1 {{ $image := (.Page.Resources.GetMatch .Destination) }}{{ $alt := .Text }}{{ $title := "" }} {{- if ne .Text "" }}{{ $title = .Text }}{{- end }}{{ if ne .Title "" -}}{{ $title = .Title }}{{ end -}}{{ $ratio := "r68" }}{{ $orientation := "portrait" }}{{ $size := "normal" }} 2 3 {{- if gt $image.Width $image.Height -}}{{ $orientation = "landscape" }} {{ if gt "0.58" (div (float $image.Height) $image.Width) }}{{ $ratio = "r58" }}{{ end }} {{ if gt "0.48" (div (float $image.Height) $image.Width) }}{{ $ratio = "r48" }}{{ end }} {{ if gt (div (float $image.Height) $image.Width) "0.68" }}{{ $ratio = "r68" }}{{ end }} {{ if gt (div (float $image.Height) $image.Width) "0.72" }}{{ $ratio = "r72" }}{{ end }} {{ if gt (div (float $image.Height) $image.Width) "0.79" }}{{ $ratio = "r79" }}{{ end }} {{- end -}} 4 {{ if eq (div (float $image.Height) $image.Width) 1.00 }}{{ $ratio = "r1" }}{{ end }}{{- if eq $orientation "portrait" -}}{{ if gt "300" $image.Height -}}{{ $size = "small" }}{{ end -}}{{- end -}}{{- if eq $orientation "landscape" -}}{{ if gt "300" $image.Width -}}{{ $size = "small" }}{{ end -}}{{- end -}} 5 6 <figure class="image-figure"> 7 <center> 8 <div style="display:flex;flex-direction:column;justify-content:space-between;" class="{{ $orientation }} {{ $ratio }} {{ $size }}"> 9 <div style="flex:1;display:flex;flex-direction:column;justify-content:center;"><img 10 src="{{ $image.RelPermalink }}" 11 style="max-width: 100%; height: auto;" 12 alt={{ .Text | safeHTML }} 13 title={{ .Text | safeHTML }} 14 /></div> 15 <figcaption> 16 <em>{{ .Text | safeHTML }} 17 <a title="Link to open full image." href="{{ $image.RelPermalink }}" class="view-full-size no-outline"> 18 <wrap><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120"><path d="M71.2 48.8c1.6 1.6 4.1 1.6 5.6 0L112 13.6V32c0 2.4 2.2 4.4 4.7 3.9 2-.3 3.3-2.2 3.3-4.2V4c0-2.2-1.8-4-4-4H88.2c-2 0-3.8 1.4-4.2 3.3-.4 2.5 1.6 4.7 4 4.7h18.4L71.2 43.2c-1.6 1.6-1.6 4.1 0 5.6zm20.8-.9V104c0 4.4-3.6 8-8 8H16c-4.4 0-8-3.6-8-8V36c0-4.4 3.6-8 8-8h56.1c1.1 0 2.1-.4 2.8-1.2l5.1-5.1c.6-.6.2-1.7-.7-1.7H12C5.4 20 0 25.4 0 32v76c0 6.6 5.4 12 12 12h76c6.6 0 12-5.4 12-12V40.6c0-.9-1.1-1.3-1.7-.7L93.2 45c-.8.8-1.2 1.8-1.2 2.9z"></path></svg></wrap> 19 </a> 20 </em> 21 </figcaption> 22 </div> 23 </center> 24 </figure>