hugo

Fork of github.com/gohugoio/hugo with reverse pagination support

git clone git://git.shimmy1996.com/hugo.git

imgproc.html (871B)

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