Skip to content

Commit

Permalink
image_tag in image_with_text
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerrowsell committed Aug 30, 2022
1 parent 578d502 commit b9ebb1e
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions sections/image-with-text.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,12 @@
{% if section.settings.height == 'adapt' and section.settings.image != blank %} style="padding-bottom: {{ 1 | divided_by: section.settings.image.aspect_ratio | times: 100 }}%;"{% endif %}
>
{%- if section.settings.image != blank -%}
<img
srcset="{%- if section.settings.image.width >= 165 -%}{{ section.settings.image | image_url: width: 165 }} 165w,{%- endif -%}
{%- if section.settings.image.width >= 360 -%}{{ section.settings.image | image_url: width: 360 }} 360w,{%- endif -%}
{%- if section.settings.image.width >= 535 -%}{{ section.settings.image | image_url: width: 535 }} 535w,{%- endif -%}
{%- if section.settings.image.width >= 750 -%}{{ section.settings.image | image_url: width: 750 }} 750w,{%- endif -%}
{%- if section.settings.image.width >= 1070 -%}{{ section.settings.image | image_url: width: 1070 }} 1070w,{%- endif -%}
{%- if section.settings.image.width >= 1500 -%}{{ section.settings.image | image_url: width: 1500 }} 1500w,{%- endif -%}
{{ section.settings.image | image_url }} {{ section.settings.image.width }}w"
src="{{ section.settings.image | image_url: width: 1500 }}"
sizes="(min-width: {{ settings.page_width }}px) {{ settings.page_width | minus: 100 | divided_by: 2 }}px, (min-width: 750px) calc((100vw - 130px) / 2), calc((100vw - 50px) / 2)"
alt="{{ section.settings.image.alt | escape }}"
loading="lazy"
width="{{ section.settings.image.width }}"
height="{{ section.settings.image.height }}"
>
{% capture sizes %}(min-width: {{ settings.page_width }}px) {{ settings.page_width | minus: 100 | divided_by: 2 }}px, (min-width: 750px) calc((100vw - 130px) / 2), calc((100vw - 50px) / 2){% endcapture %}
{{ section.settings.image | image_url: width: 1500 | image_tag:
loading: 'lazy',
sizes: sizes,
widths: '165, 360, 535, 750, 1070, 1500'
}}
{%- else -%}
{{ 'image' | placeholder_svg_tag: 'placeholder-svg' }}
{%- endif -%}
Expand Down

0 comments on commit b9ebb1e

Please sign in to comment.