1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-11-15 01:25:28 +01:00
blog/_src/_includes/picture.html

31 lines
1.0 KiB
HTML
Raw Normal View History

2017-07-23 20:40:33 +02:00
{% case include.size %}
{% when 'phototeaser' %}
2017-07-23 21:51:40 +02:00
{% assign pictureSize = 'w_940%2Ch_700%2Cc_fill' %}
{% assign pictureSizeRetina = 'w_1880%2Ch_1400%2Cc_fill' %}
2017-07-23 20:40:33 +02:00
{% when 'photothumb' %}
2017-07-23 21:51:40 +02:00
{% assign pictureSize = 'w_190%2Ch_190%2Cc_thumb' %}
{% assign pictureSizeRetina = 'w_380%2Ch_380%2Cc_thumb' %}
2017-07-23 20:40:33 +02:00
{% when 'featured' %}
2017-07-23 21:51:40 +02:00
{% assign pictureSize = 'w_275%2Ch_100%2Cc_fill' %}
{% assign pictureSizeRetina = 'w_550%2Ch_200%2Cc_fill' %}
2017-07-23 20:40:33 +02:00
{% else %}
{% assign pictureSize = 'w_940' %}
{% assign pictureSizeRetina = 'w_1880' %}
{% endcase %}
{% if include.file %}
{% assign pictureSrc = include.file %}
{% else %}
{% if page.image %}
{% assign pictureSrc = page.image %}
{% else %}
{% assign pictureSrc = post.image %}
{% endif %}
{% endif %}
<picture>
<source srcset="{{ site.media_url }}/{{ pictureSizeRetina }}/media/{{ pictureSrc }}" media="(-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi)">
<img srcset="{{ site.media_url }}/{{ pictureSize }}/media/{{ pictureSrc }}" alt="">
</picture>