You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pages/layouts/shortcodes/imgproc.html

28 lines
853 B
HTML

{{ $img := .Page.Resources.GetMatch (printf "*%s*" (.Get 0)) }}
{{ $command := .Get 1 }}
{{ $options := .Get 2 }}
{{ $figclass := .Get 3 }}
{{ $imgclass := .Get 4 }}
{{ 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 class="figure {{ $figclass }}">
<img class="figure-img img img-fluid" src="{{ $img.RelPermalink }}" width="{{ $img.Width }}" height="{{ $img.Height }}">
{{ with .Inner }}
<figcaption class="figure-caption">
<small>
{{ . | markdownify }}
</small>
</figcaption>
{{ end }}
</figure>