github.com/rabbouni145/gg@v0.47.1/docs/layouts/shortcodes/imgproc.html (about) 1 {{ $original := .Page.Resources.GetMatch (printf "*%s*" (.Get 0)) }} 2 {{ $command := .Get 1 }} 3 {{ $options := .Get 2 }} 4 {{ if eq $command "Fit"}} 5 {{ .Scratch.Set "image" ($original.Fit $options) }} 6 {{ else if eq $command "Resize"}} 7 {{ .Scratch.Set "image" ($original.Resize $options) }} 8 {{ else if eq $command "Fill"}} 9 {{ .Scratch.Set "image" ($original.Fill $options) }} 10 {{ else }} 11 {{ errorf "Invalid image processing command: Must be one of Fit, Fill or Resize."}} 12 {{ end }} 13 {{ $image := .Scratch.Get "image" }} 14 <figure style="padding: 0.25rem; margin: 2rem 0; background-color: #cccc"> 15 <img style="max-width: 100%; height: auto;" src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}"> 16 <figcaption> 17 <small> 18 {{ with .Inner }} 19 {{ . }} 20 {{ else }} 21 .{{ $command }} "{{ $options }}" 22 {{ end }} 23 </small> 24 </figcaption> 25 </figure>