mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
19 lines
No EOL
772 B
HTML
19 lines
No EOL
772 B
HTML
{{ $original := .Page.Resources.GetByPrefix (.Get 0) }}
|
|
{{ $command := .Get 1 }}
|
|
{{ $options := .Get 2 }}
|
|
{{ 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) }}
|
|
{{ else }}
|
|
{{ errorf "Invalid image processing command: Must be one of Fit, Fill or Resize."}}
|
|
{{ end }}
|
|
{{ $image := .Scratch.Get "image" }}
|
|
<figure style="width: {{ add $image.Width 3 }}px; padding: 3px; background-color: #cccc">
|
|
<img src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}">
|
|
<figcaption>
|
|
<small>.{{ $command }} "{{ $options }}"</small>
|
|
</figcaption>
|
|
</figure> |