commit edf1502b235f267deccd6f0fd8e71d1086745d13 parent a962c32f4a69536dffc17594c32578c3429bcbd4 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Sun, 4 Nov 2018 21:09:11 +0100 Add missing imgproc shortcode Diffstat:
A | layouts/shortcodes/imgproc.html | | | 16 | ++++++++++++++++ |
1 file changed, 16 insertions(+), 0 deletions(-)
diff --git a/layouts/shortcodes/imgproc.html b/layouts/shortcodes/imgproc.html @@ -0,0 +1,16 @@ +{{ $original := .Page.Resources.GetMatch (printf "*%s*" (.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="padding: 0.0rem; margin: 0rem 0; background-color: #ffffff"> + <img style="max-width: 100%; height: auto;" src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}"> +</figure>