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 }} +