Skip to content

Commit

Permalink
display Bevy logo if an image is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf committed Nov 4, 2023
1 parent 89e8601 commit cbd5bed
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions templates/macros/images.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
{%- if path is ending_with(".svg") or path is ending_with(".gif") or path is ending_with(".webp") -%}
{{- get_url(path=path) -}}
{%- else -%}
{%- set image = resize_image(path=path, width=width, height=height, op="fit") -%}
{{- image.url -}}
{% set metadata = get_image_metadata(path=path, allow_missing=true) %}
{% if metadata %}
{%- set image = resize_image(path=path, width=width, height=height, op="fit") -%}
{{- image.url -}}
{% else %}
assets/bevy_icon_dark.svg
{% endif %}
{%- endif -%}
{%- endmacro card %}

0 comments on commit cbd5bed

Please sign in to comment.