aboutsummaryrefslogtreecommitdiff
path: root/themes/docsy/layouts/shortcodes/imgproc.html
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2019-10-06 21:10:46 +0200
committerDimitri Staessens <dimitri@ouroboros.rocks>2019-10-06 21:10:46 +0200
commit568553394d0a8b34668a75c9839a0f1f426469b2 (patch)
tree175c08844f05611b059ba6900fb6519dbbc735d2 /themes/docsy/layouts/shortcodes/imgproc.html
parentd5d6f70371958eec0679831abd283498ff2731e5 (diff)
downloadwebsite-568553394d0a8b34668a75c9839a0f1f426469b2.tar.gz
website-568553394d0a8b34668a75c9839a0f1f426469b2.zip
theme: Switch to docsy theme
Diffstat (limited to 'themes/docsy/layouts/shortcodes/imgproc.html')
-rw-r--r--themes/docsy/layouts/shortcodes/imgproc.html21
1 files changed, 21 insertions, 0 deletions
diff --git a/themes/docsy/layouts/shortcodes/imgproc.html b/themes/docsy/layouts/shortcodes/imgproc.html
new file mode 100644
index 0000000..bb80a85
--- /dev/null
+++ b/themes/docsy/layouts/shortcodes/imgproc.html
@@ -0,0 +1,21 @@
+{{ $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" }}
+<div class="card rounded p-2 td-post-card mb-4 mt-4" style="max-width: {{ add $image.Width 10 }}px">
+ <img class="card-img-top" src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}">
+ {{ with .Inner }}
+ <div class="card-body px-0 pt-2 pb-0">
+ <p class="card-text">{{ . }}{{ with $image.Params.byline }}<small class="text-muted"><br/>{{ . | html }}</small>{{ end }}</p>
+ </div>
+ {{ end }}
+</div> \ No newline at end of file