github.com/shohhei1126/hugo@v0.42.2-0.20180623210752-3d5928889ad7/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="width: {{ add $image.Width 3 }}px; padding: 3px; background-color: #cccc"> 15 <img 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>