From 88b0b179a0e789238a125027e378cc3f5f46eb83 Mon Sep 17 00:00:00 2001 From: panr Date: Sat, 3 Aug 2019 18:25:32 +0200 Subject: [PATCH] Add imgproc shortcode --- layouts/shortcodes/imgproc.html | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 layouts/shortcodes/imgproc.html diff --git a/layouts/shortcodes/imgproc.html b/layouts/shortcodes/imgproc.html new file mode 100644 index 0000000..d4ac2de --- /dev/null +++ b/layouts/shortcodes/imgproc.html @@ -0,0 +1,24 @@ +{{ $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" }} + +
+ + {{ with .Inner }} +
+ {{ . }} +
+ {{ end }} +