{{ $original := .Page.Resources.GetMatch (.Get "src") }}
{{ $options := default "1000x" (.Get "options") }}
{{ .Scratch.Set "image" $original }}
{{ $command := (default "Resize" (.Get "command")) }}
{{ if eq $command "Fit"}}
{{ .Scratch.Set "image" ($original.Fit $options) }}
{{ else if eq $command "Resize"}}
{{ .Scratch.Set "image" ($original.Resize $options) }}
{{ else if eq $command "Fill"}}
{{ .Scratch.Set "image" ($original.Fill $options) }}
{{ end }}
{{ define "img" }}
{{ $image := .Scratch.Get "image" }}
{{ end }}
{{ if .Inner }}
{{ else }}
{{ template "img" . }}
{{ end }}