Skip to content

Commit

Permalink
Do not use image resizing for gifs
Browse files Browse the repository at this point in the history
  • Loading branch information
Alainx277 committed Jan 10, 2024
1 parent e973d07 commit 1ae9a1c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions templates/shortcodes/image.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
{% set width = meta.width %}
{% set srcset_list = [] %}
{% set image_config = config.extra.images | get(key=kind) %}

{% if src is ending_with(".gif") %}

<div class="image"><a href="/{{ src }}" class="image-link" target="_blank"><img src="/{{ src | safe }}" style="max-width: {{ image_config.default_size }}px"/></a></div>

{% else %}

{% for s in image_config.image_sizes %}
{% if width >= s %}
{% set resized = resize_image(path=abspath, width=s, op="fit_width") %}
Expand All @@ -12,3 +19,5 @@
{% endfor %}
{% set default_resized = resize_image(path=abspath, width=image_config.default_size, op="fit_width") %}
<div class="image"><a href="/{{ src }}" class="image-link" target="_blank"><img src="{{ default_resized.url | safe }}" srcset="{{ srcset_list | join(sep=", ") | safe }}" sizes="{{ image_config.sizes }}" /></a></div>

{% endif %}

0 comments on commit 1ae9a1c

Please sign in to comment.