diff options
Diffstat (limited to 'templates/shortcodes/img.html')
| -rw-r--r-- | templates/shortcodes/img.html | 7 |
1 files changed, 7 insertions, 0 deletions
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 %} <img src="{{ path | safe }}{{ img | safe }}"{% if class %} class="{{class}}"{% endif %}{% if alt %} alt="{{alt}}"{% endif %}{% if w %} width="{{w}}"{% endif %}{% if h %} height="{{h}}"{% endif %} /> |
