🐛 fix: handle missing image metadata gracefully
This commit is contained in:
parent
be8ec45c35
commit
b5b50cdefb
@ -7,7 +7,7 @@
|
|||||||
<a rel="noopener noreferrer" target="_blank" href={{ page.extra.link_to }}>
|
<a rel="noopener noreferrer" target="_blank" href={{ page.extra.link_to }}>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if page.extra.local_image %}
|
{% if page.extra.local_image %}
|
||||||
{% set meta = get_image_metadata(path=page.extra.local_image) %}
|
{% set meta = get_image_metadata(path=page.extra.local_image, allow_missing=true) %}
|
||||||
<img class="card-image" alt={{ page.extra.local_image }} src="{{ get_url(path=page.extra.local_image) }}" {% if meta.width %}width="{{ meta.width }}" {% endif %} {% if meta.height %}height="{{ meta.height }}" {% endif %}>
|
<img class="card-image" alt={{ page.extra.local_image }} src="{{ get_url(path=page.extra.local_image) }}" {% if meta.width %}width="{{ meta.width }}" {% endif %} {% if meta.height %}height="{{ meta.height }}" {% endif %}>
|
||||||
{% elif page.extra.remote_image %}
|
{% elif page.extra.remote_image %}
|
||||||
<img class="card-image" alt={{ page.extra.remote_image }} src="{{ page.extra.remote_image }}">
|
<img class="card-image" alt={{ page.extra.remote_image }} src="{{ page.extra.remote_image }}">
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
{% set meta = get_image_metadata(path=src) %}
|
{% set meta = get_image_metadata(path=src, allow_missing=true) %}
|
||||||
<img class="dimmable-image" src="{{ get_url(path=src) }}" {% if alt %}alt="{{ alt }}" {% endif %} {% if meta.width %}width="{{ meta.width }}" {% endif %} {% if meta.height %}height="{{ meta.height }}" {% endif %}/>
|
<img class="dimmable-image" src="{{ get_url(path=src) }}" {% if alt %}alt="{{ alt }}" {% endif %} {% if meta.width %}width="{{ meta.width }}" {% endif %} {% if meta.height %}height="{{ meta.height }}" {% endif %}/>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% set light_meta = get_image_metadata(path=light_src) %}
|
{% set light_meta = get_image_metadata(path=light_src, allow_missing=true) %}
|
||||||
{% set dark_meta = get_image_metadata(path=dark_src) %}
|
{% set dark_meta = get_image_metadata(path=dark_src, allow_missing=true) %}
|
||||||
<img src="{{ get_url(path=light_src) }}" {% if alt %}alt="{{ alt }}" {% endif %} {% if light_meta.width %}width="{{ light_meta.width }}" {% endif %} {% if light_meta.height %}height="{{ light_meta.height }}" {% endif %} class="img-light">
|
<img src="{{ get_url(path=light_src) }}" {% if alt %}alt="{{ alt }}" {% endif %} {% if light_meta.width %}width="{{ light_meta.width }}" {% endif %} {% if light_meta.height %}height="{{ light_meta.height }}" {% endif %} class="img-light">
|
||||||
<img src="{{ get_url(path=dark_src) }}" {% if alt %}alt="{{ alt }}" {% endif %} {% if dark_meta.width %}width="{{ dark_meta.width }}" {% endif %} {% if dark_meta.height %}height="{{ dark_meta.height }}" {% endif %} class="img-dark">
|
<img src="{{ get_url(path=dark_src) }}" {% if alt %}alt="{{ alt }}" {% endif %} {% if dark_meta.width %}width="{{ dark_meta.width }}" {% endif %} {% if dark_meta.height %}height="{{ dark_meta.height }}" {% endif %} class="img-dark">
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
{% set meta = get_image_metadata(path=src) %}
|
{% set meta = get_image_metadata(path=src, allow_missing=true) %}
|
||||||
<img class="invertible-image" {% if src %}src="{{ get_url(path=src) }}" {% endif %} {% if alt %}alt="{{ alt }}" {% endif %} {% if meta.width %}width="{{ meta.width }}" {% endif %} {% if meta.height %}height="{{ meta.height }}" {% endif %}/>
|
<img class="invertible-image" {% if src %}src="{{ get_url(path=src) }}" {% endif %} {% if alt %}alt="{{ alt }}" {% endif %} {% if meta.width %}width="{{ meta.width }}" {% endif %} {% if meta.height %}height="{{ meta.height }}" {% endif %}/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user