feat: check if image exists before caching optimized version

This commit is contained in:
Cory Dransfeldt 2024-02-04 12:49:23 -08:00
parent cb6b5dbd8e
commit f0f1c0aaab
No known key found for this signature in database
9 changed files with 101 additions and 55 deletions

View file

@ -11,12 +11,9 @@
{% for mention in mentions[type] %}
<a href={{mention.url}}>
<div class="avatar__wrapper flex--centered">
<img
src="{{ mention.author.photo }}"
alt="{{ mention.author.name | escape }}"
class="avatar__image"
loading="lazy"
onerror="this.onerror=null; this.src='/assets/img/icons/user.webp'" />
{% capture authorAlt %}{{ mention.author.name | escape }}{% endcapture %}
{% capture fallbackIcon %}{% tablericon "user" authorAlt %}{% endcapture %}
{% image mention.author.photo, authorAlt, 'avatar__image', 'lazy', 'rounded', fallbackIcon %}
</div>
</a>
{% endfor %}