aboutsummaryrefslogtreecommitdiff
path: root/templates/shortcodes/img.html
diff options
context:
space:
mode:
Diffstat (limited to 'templates/shortcodes/img.html')
-rw-r--r--templates/shortcodes/img.html17
1 files changed, 14 insertions, 3 deletions
diff --git a/templates/shortcodes/img.html b/templates/shortcodes/img.html
index a5a0541..d599ba0 100644
--- a/templates/shortcodes/img.html
+++ b/templates/shortcodes/img.html
@@ -6,7 +6,12 @@
{%- set path = src | trim_start_matches(pat="./") | split(pat="/") | slice(end=-1) | join(sep="/") | trim_start_matches(pat="/") %}
{%- set path = path ~ "/" %}
{%- if not w or not h %}
- {%- set meta = get_image_metadata(path=page.path ~ path ~ img) %}
+ {%- if lang != config.default_language %}
+ {%- set metapath = page.path ~ path ~ img | replace(from=page.path | truncate(length=4, end=""), to="/") %}
+ {%- else %}
+ {%- set metapath = page.path ~ path ~ img %}
+ {%- endif %}
+ {%- set meta = get_image_metadata(path=metapath) %}
{%- set w = meta.width %}
{%- set h = meta.height %}
{%- endif %}
@@ -15,7 +20,8 @@
{%- set rootpath = src | split(pat="/") | slice(end=-1) | join(sep="/") %}
{%- set path = config.base_url ~ rootpath ~ "/" %}
{%- if not w or not h %}
- {%- set meta = get_image_metadata(path=rootpath ~ "/" ~ img) %}
+ {%- set metapath = rootpath ~ "/" ~ img %}
+ {%- set meta = get_image_metadata(path=metapath) %}
{%- set w = meta.width %}
{%- set h = meta.height %}
{%- endif %}
@@ -23,7 +29,12 @@
{%- else %} {# Same Directory Path #}
{%- set path = page.path %}
{%- if not w or not h %}
- {%- set meta = get_image_metadata(path=page.path ~ img) %}
+ {%- if lang != config.default_language %}
+ {%- set metapath = page.path ~ img | replace(from=page.path | truncate(length=4, end=""), to="/") %}
+ {%- else %}
+ {%- set metapath = page.path ~ img %}
+ {%- endif %}
+ {%- set meta = get_image_metadata(path=metapath) %}
{%- set w = meta.width %}
{%- set h = meta.height %}
{%- endif %}