From a81584328453914398217a67b0651d29b8b7531b Mon Sep 17 00:00:00 2001 From: Alexis BENOIT <alex@noesya.coop> Date: Mon, 7 Oct 2024 15:08:10 +0200 Subject: [PATCH] =?UTF-8?q?Ratio=20des=20images=20depuis=20les=20donn?= =?UTF-8?q?=C3=A9es=20(#640)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layouts/partials/GetImageDirection | 5 ++--- layouts/partials/GetImageRatio | 10 ---------- 2 files changed, 2 insertions(+), 13 deletions(-) delete mode 100644 layouts/partials/GetImageRatio diff --git a/layouts/partials/GetImageDirection b/layouts/partials/GetImageDirection index da1d8e3b..664e9485 100644 --- a/layouts/partials/GetImageDirection +++ b/layouts/partials/GetImageDirection @@ -1,9 +1,8 @@ -{{ $ratio := partial "GetImageRatio" . }} {{ $direction := "square" }} -{{ if gt $ratio 1 }} +{{ if gt .ratio 1 }} {{ $direction = "landscape" }} -{{ else if lt $ratio 1 }} +{{ else if lt .ratio 1 }} {{ $direction = "portrait" }} {{ end }} diff --git a/layouts/partials/GetImageRatio b/layouts/partials/GetImageRatio deleted file mode 100644 index b17f0b3d..00000000 --- a/layouts/partials/GetImageRatio +++ /dev/null @@ -1,10 +0,0 @@ -{{ $image := partial "GetMedia" .id }} -{{ $ratio := 1 }} - -{{ if $image }} - {{ if and $image.width $image.height }} - {{ $ratio = div (float $image.width) (float $image.height) }} - {{ end }} -{{ end }} - -{{ return $ratio }} \ No newline at end of file -- GitLab