mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-29 04:22:06 -05:00
26 lines
871 B
HTML
26 lines
871 B
HTML
{{ $img := .Page.Resources.GetMatch (printf "*%s*" (.Get 0)) }}
|
|
{{ $command := .Get 1 }}
|
|
{{ $options := .Get 2 }}
|
|
{{ if eq $command "Fit"}}
|
|
{{ $img = $img.Fit $options }}
|
|
{{ else if eq $command "Resize"}}
|
|
{{ $img = $img.Resize $options }}
|
|
{{ else if eq $command "Fill"}}
|
|
{{ $img = $img.Fill $options }}
|
|
{{ else if eq $command "Crop"}}
|
|
{{ $img = $img.Crop $options }}
|
|
{{ else }}
|
|
{{ errorf "Invalid image processing command: Must be one of Crop, Fit, Fill or Resize."}}
|
|
{{ end }}
|
|
<figure style="padding: 0.25rem; margin: 2rem 0; background-color: #cccc">
|
|
<img style="max-width: 100%; width: auto; height: auto;" src="{{ $img.RelPermalink }}" width="{{ $img.Width }}" height="{{ $img.Height }}">
|
|
<figcaption>
|
|
<small>
|
|
{{ with .Inner }}
|
|
{{ . }}
|
|
{{ else }}
|
|
.{{ $command }} "{{ $options }}"
|
|
{{ end }}
|
|
</small>
|
|
</figcaption>
|
|
</figure>
|