From a52155845918831377ef6307c6ac5a9ba6b77b95 Mon Sep 17 00:00:00 2001 From: MyZeD Date: Tue, 8 Oct 2024 18:32:57 +0200 Subject: [PATCH] Update .gitignore and templates to resize donor and news images --- .gitignore | 1 + templates/news.html | 2 +- templates/sponsors.html | 14 ++++++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index b428d603e0..09c7667442 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ content/community/people/ content/community/donate/ static/assets/examples/ static/processed_images/ +static/assets/donor_logos/ # Tools target/ diff --git a/templates/news.html b/templates/news.html index 8f0bba66c2..10e7f21979 100644 --- a/templates/news.html +++ b/templates/news.html @@ -9,7 +9,7 @@ {% if page.extra.image %} {% set image_parent = page.path | replace(from="_index.md", to="") %} An image representing the article {% else %} diff --git a/templates/sponsors.html b/templates/sponsors.html index c5c9dfda4c..a60a2a1c36 100644 --- a/templates/sponsors.html +++ b/templates/sponsors.html @@ -56,13 +56,14 @@

${{ tier.amount }} / month

{% for donor in donors_in_tier %} {% if tier.reward_logo and donor.logo %} - {% set_global logo_height = tier.logo_height %} + {% set_global logo_height = tier.logo_height | int %} {% if donor.square_logo %} - {% set_global logo_height = logo_height * 2.0 %} + {% set_global logo_height = (logo_height * 2.0) | int %} {% endif %} {% if donor.logo_scale %} - {% set_global logo_height = logo_height * donor.logo_scale %} + {% set_global logo_height = (logo_height * donor.logo_scale) | int %} {% endif %} + {% set logo_path = "/assets/donor_logos/" ~ donor.logo %} ${{ tier.amount }} / month {% if donor.style %} style="{{ donor.style }}" {% endif %} - src="/assets/donor_logos/{{ donor.logo }}" + {% if donor.logo is matching("\.svg$") %} + src="{{ logo_path }}" + {% else %} + {% set image = resize_image(path=logo_path, op="fit_height", height=logo_height) %} + src="{{ image.url }}" + {% endif %} {% if donor.name %} alt="{{ donor.name }} logo" {% endif %}