You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
{# {{ img(url="", alt="", caption="", resize=false, allow_tall=false) }} #} |
|
|
|
|
|
{% set article_width = 1280 %} |
|
|
|
|
|
{% if resize %} |
|
|
{% set effective_image = resize_image(path=url, width=article_width, op="fit_width") %} |
|
|
{% else %} |
|
|
{% set effective_image = get_image_metadata(path=url) %} |
|
|
{% endif %} |
|
|
|
|
|
{% set full_image_url = get_url(path=url) %} |
|
|
|
|
|
{% set crop_height = config.extra.image_vertical_crop_height | default(value=768) %} |
|
|
|
|
|
{% set cropped = effective_image.height > crop_height and not allow_tall %} |
|
|
|
|
|
<figure> |
|
|
<img |
|
|
src="{% if resize %}{{ effective_image.url }}{% else %}{{ full_image_url }}{% endif %}" |
|
|
alt="{{ alt }}" |
|
|
title="{{ alt }}" |
|
|
{%- if cropped %}height="{{ crop_height }}" width="{{article_width}}"{% endif %} |
|
|
> |
|
|
{% if caption or resize or cropped %} |
|
|
<div> |
|
|
{% if caption %}<figcaption>{{ caption | safe }}</figcaption>{% endif %} |
|
|
{% if resize or cropped %}<a href="{{ full_image_url }}" target="_blank">↗️ full size</a>{% endif %} |
|
|
</div> |
|
|
{% endif %} |
|
|
</figure> |