diff --git a/_config.yml b/_config.yml index b06e8423dd53..017585717c10 100644 --- a/_config.yml +++ b/_config.yml @@ -329,6 +329,8 @@ external_links: # Responsive WebP Images # ----------------------------------------------------------------------------- +# MAKE SURE imagemagick is installed and on your PATH before enabling imagemagick. In a terminal, run: +# convert -version imagemagick: enabled: true # enables responsive images for your site (recommended, see https://github.com/alshedivat/al-folio/issues/537) widths: @@ -342,8 +344,9 @@ imagemagick: - ".jpeg" - ".png" - ".tiff" + - ".gif" output_formats: - webp: "-resize 800x" + webp: "-quality 85 -strip" # ----------------------------------------------------------------------------- # Jekyll Diagrams diff --git a/_includes/figure.html b/_includes/figure.html index eb3dc28f914f..5bf766a88ac9 100644 --- a/_includes/figure.html +++ b/_includes/figure.html @@ -1,23 +1,22 @@ -{%- assign img_path = include.path | remove: ".jpg" | remove: ".jpeg" | remove: ".png" | remove: ".tiff" -%} +{%- assign img_path = include.path | remove: ".jpg" | remove: ".jpeg" | remove: ".png" | remove: ".tiff" | remove: ".gif" -%}
- + + {% if site.imagemagick.enabled %} - {% for i in site.imagemagick.widths -%} - - {% endfor -%} + {% endif %} - - project thumbnail diff --git a/_includes/projects_horizontal.html b/_includes/projects_horizontal.html index 5db8bcc7a1eb..5df1ca90b1c4 100644 --- a/_includes/projects_horizontal.html +++ b/_includes/projects_horizontal.html @@ -8,7 +8,7 @@
{%- if project.img -%}
- {% include figure.html path=project.img alt="project thumbnail" %} + {% include figure.html path=project.img sizes="(min-width: 768px) 156px, 50vw" alt="project thumbnail" %}
{%- else -%} diff --git a/_layouts/about.html b/_layouts/about.html index 38d9c236c18f..be84f6e456aa 100644 --- a/_layouts/about.html +++ b/_layouts/about.html @@ -23,11 +23,15 @@

{%- assign profile_image_class = "img-fluid z-depth-1 rounded" -%} {% endif %} + {% capture sizes %}(min-width: {{site.max_width}}) {{ site.max_width | minus: 30 | times: 0.3}}px, (min-width: 576px) 30vw, 95vw"{% endcapture %} + {% include figure.html - path=profile_image_path - class=profile_image_class - alt=page.profile.image - cache_bust=true -%} + path = profile_image_path + class = profile_image_class + sizes = sizes + alt = page.profile.image + cache_bust = true + %} {% endif -%} {%- if page.profile.more_info %}
diff --git a/_layouts/bib.html b/_layouts/bib.html index 2537fb9e1722..6ef0648c523f 100644 --- a/_layouts/bib.html +++ b/_layouts/bib.html @@ -11,6 +11,7 @@ {%- assign entry_path = entry.preview | prepend: '/assets/img/publication_preview/' -%} {% include figure.html path=entry_path + sizes = "200px" class="preview z-depth-1 rounded" zoomable=false alt=entry.preview -%} diff --git a/_layouts/profiles.html b/_layouts/profiles.html index 40e9f38041e4..4542fcb28702 100644 --- a/_layouts/profiles.html +++ b/_layouts/profiles.html @@ -19,10 +19,14 @@ {%- assign profile_image_class = "img-fluid z-depth-1 rounded" -%} {% endif %} + {% capture sizes %}(min-width: {{site.max_width}}) {{ site.max_width | minus: 30 | times: 0.3}}px, (min-width: 576px) 30vw, 95vw"{% endcapture %} + {% include figure.html - path=profile_image_path - class=profile_image_class - alt=profile.image -%} + path = profile_image_path + class = profile_image_class + sizes = sizes + alt = profile.image + %} {% endif -%} {%- if profile.more_info %}