summaryrefslogtreecommitdiff
path: root/layouts/shortcodes/imgproc.html
diff options
context:
space:
mode:
authorMichał Sapka <michal@sapka.me>2023-01-08 12:12:11 +0100
committerMichał Sapka <michal@sapka.me>2023-01-08 12:12:11 +0100
commit0381d2e62d10fd30402c29d85041071adcc483bf (patch)
tree7a07eb53f9b4f95c71750af29b8a3db3e07c6817 /layouts/shortcodes/imgproc.html
parent8987664e3ab4dd08879c3d45ba4ba954aaec6f69 (diff)
feat: basic list
Diffstat (limited to 'layouts/shortcodes/imgproc.html')
-rw-r--r--layouts/shortcodes/imgproc.html20
1 files changed, 20 insertions, 0 deletions
diff --git a/layouts/shortcodes/imgproc.html b/layouts/shortcodes/imgproc.html
new file mode 100644
index 0000000..c8f75c2
--- /dev/null
+++ b/layouts/shortcodes/imgproc.html
@@ -0,0 +1,20 @@
+{{ $img := .Page.Resources.GetMatch (printf "*%s*" (.Get 0)) }}
+{{ $command := .Get 1 }}
+{{ $options := .Get 2 }}
+{{ 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>
+ <img class="centered" src="{{ $img.RelPermalink }}" width="{{ $img.Width }}" height="{{ $img.Height }}">
+ <figcaption>
+ {{.Get 3}}
+ </figcaption>
+</figure>