feat: Mise à jour des tailles d'image
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@ -1,13 +1,22 @@
|
||||
{{ define "main" }}
|
||||
<div class="container">
|
||||
{{ $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 }}
|
||||
<img
|
||||
class="hero no-print"
|
||||
src="{{ $resized.RelPermalink }}"
|
||||
src="{{ $image.RelPermalink }}"
|
||||
alt="{{ or .Params.image_ .Params.image_credit }}"
|
||||
title="{{ or .Params.image_ .Params.image_credit }}"
|
||||
/>
|
||||
|
Reference in New Issue
Block a user