From f49d28caa3005c608eec9f8f82b1d9625ae37c01 Mon Sep 17 00:00:00 2001 From: Timmy Keller Date: Sat, 10 Aug 2024 21:03:16 -0500 Subject: initial commit --- layouts/shortcodes/img.html | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 layouts/shortcodes/img.html (limited to 'layouts/shortcodes/img.html') diff --git a/layouts/shortcodes/img.html b/layouts/shortcodes/img.html new file mode 100644 index 0000000..65ca44f --- /dev/null +++ b/layouts/shortcodes/img.html @@ -0,0 +1,34 @@ + + + +{{ $image := resources.GetMatch (.Get "src") }} + + +{{ $alt := .Get "alt" | default "" }} +{{ $rotation := .Get "rotation" | default 0 }} + + +{{ $quality := .Get "quality" | default "original" }} + +{{ $q := 0 }} +{{ $size := 0 }} +{{ if eq $quality "low" }} + {{ $q = 60 }} + {{ $size = 600 }} +{{ else if eq $quality "medium" }} + {{ $q = 75 }} + {{ $size = 1000 }} +{{ else if eq $quality "high" }} + {{ $q = 90 }} + {{ $size = 1200 }} +{{ end }} + + + +{{ if ne $quality "original" }} + {{ $image = $image.Resize (printf "%dx q%d r%d" $size $q $rotation) }} +{{ end }} +
+ {{ $alt }} +
{{ $alt }}
+
-- cgit v1.2.3