{{- $source := ($.Page.Resources.ByType "image").GetMatch (printf "%s" (.Get "name")) }}
{{- $customAlt := .Get "alt" }}
{{- $customSize := .Get "size" | lower }}
{{- $customAnchor := default "smart" (.Get "anchor") | title }}
{{- $data := newScratch }}

{{- with $source }}
  {{- $caption := default .Title $customAlt }}
  {{- $isSVG := (eq .MediaType.SubType "svg") }}
  {{- $origin := . -}}

  {{- if $isSVG }}
    {{- $data.SetInMap "size" "tiny" "160" }}
    {{- $data.SetInMap "size" "small" "300" }}
    {