From dc1713cd71ad9fc1aa0ec968ec70b6634322774b Mon Sep 17 00:00:00 2001 From: Simon C Date: Tue, 7 May 2024 16:41:34 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20Mise=20=C3=A0=20jour=20des=20tailles=20?= =?UTF-8?q?d'image?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/styles/main.sass | 3 +++ layouts/actualites/single.html | 15 ++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/assets/styles/main.sass b/assets/styles/main.sass index c8ff35a..dfe1035 100644 --- a/assets/styles/main.sass +++ b/assets/styles/main.sass @@ -79,6 +79,9 @@ li margin-top: -10vh min-height: 50vh + .hero + margin: auto + @media screen and (max-width: $size-md) min-height: inherit diff --git a/layouts/actualites/single.html b/layouts/actualites/single.html index 749a337..4f0b1b2 100644 --- a/layouts/actualites/single.html +++ b/layouts/actualites/single.html @@ -1,13 +1,22 @@ {{ define "main" }}
{{ $headless := site.GetPage "/" }} - {{ $imageSize := "1208x459 Center webp" }} + {{ $widthOriginal := 1920 }} + {{ $heightOriginal := 850 }} + {{ $width := 1208 }} + {{ $height := 534 }} {{ $image := default ($headless.Resources.GetMatch "**.jpg") (.Resources.GetMatch (default "**.jpg" .Params.image)) }} {{ if $image }} - {{ $resized := $image.Fill $imageSize }} + {{ if and (ge $image.Width $widthOriginal) (ge $image.Height $heightOriginal) }} + {{ $image = $image.Process (printf "fill %dx%d Center webp" $width $height) }} + {{ else if gt $image.Height $height }} + {{ $image = $image.Process (printf "resize x%d webp" $height) }} + {{ else }} + {{ $image = $image.Process "webp" }} + {{ end }} {{ or .Params.image_ .Params.image_credit }}