{{- $image := .Page.Resources.GetMatch .Destination -}}
{{- if $image -}}
{{ $image_resize := $image.Resize "1024x webp q80" }}

<div class="flex justify-center">
  <a href="{{- $image.RelPermalink -}}">
    <img loading="lazy" src="{{ $image_resize.RelPermalink }}" alt="{{ .Text }}" class="max-h-96">
  </a>
</div>
{{- else -}}
  <img loading="lazy" class="img-fluid" src="{{ .Destination | safeURL }}" {{ with .Text}} alt="{{ . }}" {{ else }} alt="{{ .Page.Title }}" {{ end }} {{ with .Title}} title="{{ . }}"{{ end }} />
  <p>Fallback</p>
{{- end -}}