22 lines
No EOL
1.1 KiB
HTML
22 lines
No EOL
1.1 KiB
HTML
{#
|
|
Original author: crepererum https://github.com/getzola/even/pull/48/files
|
|
Adapted to Inky template by jimmyff
|
|
#}
|
|
|
|
{% if config.extra.image_resizing_disabled and config.extra.image_resizing_disabled == true %}
|
|
<img alt="{{ alt }}" src="{{ src | safe }}" />
|
|
{% else %}
|
|
{% set abspath = "./" ~ page.path ~ src %}
|
|
{% set meta = get_image_metadata(path=abspath) %}
|
|
{% set width = meta.width %}
|
|
{% set srcset_list = [] %}
|
|
{% for s in config.extra.thumbnail_sizes %}
|
|
{% if width >= s %}
|
|
{% set resized = resize_image(format=config.extra.image_format, path=abspath, width=s, height=s, op="fill", quality=config.extra.thumbnail_quality) %}
|
|
{% set element = resized.url ~ " " ~ s ~ "w" %}
|
|
{% set_global srcset_list = srcset_list | concat(with=[element]) %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% set default_resized = resize_image(format=config.extra.image_format, path=abspath, width=config.extra.images_default_size, height=config.extra.images_default_size, op="fill", quality=config.extra.thumbnail_quality) %}
|
|
<img alt="{{ alt }}" src="{{ default_resized.url | safe }}" srcset="{{ srcset_list | join(sep=", ") | safe }}" />
|
|
{% endif %}1 |