feat: Mise à jour des tailles d'image
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Simon 2024-05-07 16:41:34 +02:00
parent da5e693f22
commit dc1713cd71
2 changed files with 15 additions and 3 deletions

View File

@ -79,6 +79,9 @@ li
margin-top: -10vh margin-top: -10vh
min-height: 50vh min-height: 50vh
.hero
margin: auto
@media screen and (max-width: $size-md) @media screen and (max-width: $size-md)
min-height: inherit min-height: inherit

View File

@ -1,13 +1,22 @@
{{ define "main" }} {{ define "main" }}
<div class="container"> <div class="container">
{{ $headless := site.GetPage "/" }} {{ $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)) }} {{ $image := default ($headless.Resources.GetMatch "**.jpg") (.Resources.GetMatch (default "**.jpg" .Params.image)) }}
{{ if $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 }}
<img <img
class="hero no-print" class="hero no-print"
src="{{ $resized.RelPermalink }}" src="{{ $image.RelPermalink }}"
alt="{{ or .Params.image_ .Params.image_credit }}" alt="{{ or .Params.image_ .Params.image_credit }}"
title="{{ or .Params.image_ .Params.image_credit }}" title="{{ or .Params.image_ .Params.image_credit }}"
/> />