tAdd missing imgproc shortcode - andersdamsgaard.com - my photography webpage | |
git clone git://src.adamsgaard.dk/andersdamsgaard.com | |
Log | |
Files | |
Refs | |
Submodules | |
README | |
LICENSE | |
--- | |
commit edf1502b235f267deccd6f0fd8e71d1086745d13 | |
parent a962c32f4a69536dffc17594c32578c3429bcbd4 | |
Author: Anders Damsgaard <[email protected]> | |
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 | |
t@@ -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 Resiz… | |
+{{ 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.RelPermalin… | |
+</figure> |