This commit is contained in:
isUnknown 2024-09-19 14:20:55 +02:00
parent 068492e495
commit 53a2ed8b0f
11 changed files with 29 additions and 21 deletions

View file

@ -13,7 +13,15 @@ return [
'format' => 'webp'
],
'srcsets' => [
'default' => [200, 400, 600, 800, 1024, 1440, 2048],
'default' => [
['width' => 200, 'format' => 'webp'],
['width' => 400, 'format' => 'webp'],
['width' => 600, 'format' => 'webp'],
['width' => 800, 'format' => 'webp'],
['width' => 1024, 'format' => 'webp'],
['width' => 1440, 'format' => 'webp'],
['width' => 2048, 'format' => 'webp']
],
],
],
'panel' => [

View file

@ -3,14 +3,14 @@
<div class="image-wrapper">
<?php if ($event->gallery()->toFiles()->count() > 1): ?>
<?php snippet('picture', [
'file' => $event->gallery()->toFiles()->first()->thumb('grid'),
'file' => $event->gallery()->toFiles()->first()->thumb(),
'class' => 'image-cover',
'size' => (100 / (12 / $span) - 10)
]) ?>
<?php endif ?>
<?php
$file = $event->gallery()->toFiles()->count() > 1 ? $event->gallery()->toFiles()->nth(1) : $event->gallery()->toFiles()->first();
snippet('picture', ["file" => $file, 'size' => (100 / (12 / $span) - 10), 'alt' => null]);
snippet('picture', ["file" => $file->thumb(), 'size' => (100 / (12 / $span) - 10), 'alt' => null]);
?>
</div>
<div class="event-card__infos">

View file

@ -4,11 +4,11 @@
$alt = $alt ?? $file->alt();
$crop = $crop ?? false;
$webPSrcset = $crop === 'banner' ? $file->crop(1600, 800)->srcset('webp') : $file->srcset('webp');
$srcset = $crop === 'banner' ? $file->crop(1600, 800)->srcset() : $file->srcset();
$src = $crop === 'banner' ? $file->crop(1600, 800)->url() : $file->url();
$width = $crop === 'banner' ? $file->crop(1600, 800)->width() : $file->resize(1800)->width();
$height = $crop === 'banner' ? $file->crop(1600, 800)->height() : $file->resize(1800)->height();
$webPSrcset = $file->srcset('webp');
$srcset = $file->srcset();
$src = $file->url();
$width = $file->resize(1800)->width();
$height = $file->resize(1800)->height();
$class = isset($class) ? 'class="' . $class . '"': '';
$lazy = $lazy ?? true;
?>

View file

@ -9,7 +9,7 @@
<div class="hero__image" style="--color: var(--color-season)">
<?php if ($site->heroLinkUrl()->isNotEmpty() == 'true'): ?>
<a href="<?= $site->heroLinkUrl()->toUrl() ?>" title="en savoir plus">
<?php snippet('picture', ['file' => $site->heroImage()->toFile(), 'lazy' => false, 'size' => 50]) ?>
<?php snippet('picture', ['file' => $site->heroImage()->toFile()->thumb(), 'lazy' => false, 'size' => 50]) ?>
</a>
<?php else: ?>
<?php snippet('picture', ['file' => $site->heroImage()->toFile()->thumb(), 'lazy' => false, 'size' => 50]) ?>