From 0e57376f244848c6513236424dffb63acd15271c Mon Sep 17 00:00:00 2001 From: Jieiku Date: Wed, 27 Jul 2022 22:46:21 -0700 Subject: img/imghover shortcodes optional width/height --- templates/shortcodes/img.html | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'templates/shortcodes/img.html') diff --git a/templates/shortcodes/img.html b/templates/shortcodes/img.html index 4645569..cf2a562 100644 --- a/templates/shortcodes/img.html +++ b/templates/shortcodes/img.html @@ -16,6 +16,13 @@ {%- endif %} +{%- if not w or not h %} + {%- set metafile = page.path ~ path ~ src %} + {%- set meta = get_image_metadata(path=metafile) %} + {%- set w = meta.width %} + {%- set h = meta.height %} +{%- endif %} + {%- set img = src | split(pat="/") | last %} {%- set name = img | split(pat=".") | first %} -- cgit v1.3.1