diff --git a/site/config/config.php b/site/config/config.php
index 2a6e19e..ef5a16d 100644
--- a/site/config/config.php
+++ b/site/config/config.php
@@ -17,10 +17,20 @@ return [
'srcsets' => [
'default' => [200, 400, 600, 800, 1024, 1440, 2048],
'webp' => [
- '300w' => ['width' => 300 * 1.2, 'format' => 'webp'],
- '600w' => ['width' => 600 * 1.2, 'format' => 'webp'],
- '900w' => ['width' => 900 * 1.2, 'format' => 'webp'],
- '1200w' => ['width' => 1200 * 1.2, 'format' => 'webp'],
+ '300w' => ['width' => 300, 'format' => 'webp'],
+ '600w' => ['width' => 600, 'format' => 'webp'],
+ '900w' => ['width' => 900, 'format' => 'webp'],
+ '1200w' => ['width' => 1200, 'format' => 'webp'],
+ ],
+ // Cover cards investigations : 465px fixe ≥1000px, 50vw 728–1000px, 100vw <728px
+ // Widths couvrent 1x et 2x (retina) pour chaque breakpoint
+ 'cover-card' => [465, 728, 930, 1000, 1456],
+ 'cover-card-webp' => [
+ '465w' => ['width' => 465, 'format' => 'webp'],
+ '728w' => ['width' => 728, 'format' => 'webp'],
+ '930w' => ['width' => 930, 'format' => 'webp'],
+ '1000w' => ['width' => 1000, 'format' => 'webp'],
+ '1456w' => ['width' => 1456, 'format' => 'webp'],
],
],
],
diff --git a/site/snippets/picture.php b/site/snippets/picture.php
index ab28a7b..fa9be7e 100644
--- a/site/snippets/picture.php
+++ b/site/snippets/picture.php
@@ -1,32 +1,46 @@
alt() ?? '';
- $crop = $crop ?? false;
+ // Sizes : accepte soit une string complète ($sizes), soit un vw simple ($size)
+ if (isset($sizes)) {
+ $sizesAttr = $sizes;
+ } elseif (isset($size)) {
+ $sizesAttr = '(min-width: 1085px) ' . $size . 'vw, 100vw';
+ } else {
+ $sizesAttr = '(min-width: 1085px) 50vw, 100vw';
+ }
- $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;
- $span = isset($span) ? 'style="--span: ' . $span . ';"': '';
+ $alt = $alt ?? $file->alt() ?? '';
+ $srcsetName = $srcsetName ?? 'default';
+ $webpName = $srcsetName . '-webp';
+ $lazy = $lazy ?? true;
+ $crop = $crop ?? false;
+
+ // Vérifie si un srcset webp nommé existe en config, sinon fallback sur 'webp'
+ $kirbyThumbs = kirby()->option('thumbs.srcsets', []);
+ $webpSrcset = isset($kirbyThumbs[$webpName])
+ ? $file->srcset($webpName)
+ : $file->srcset('webp');
+
+ $srcset = $file->srcset($srcsetName);
+ $src = $file->url();
+
+ $resized = $file->resize(1800);
+ $width = $resized ? $resized->width() : $file->width();
+ $height = $resized ? $resized->height() : $file->height();
+
+ $classAttr = isset($class) ? ' class="' . htmlspecialchars($class) . '"' : '';
+ $spanAttr = isset($span) ? ' style="--span: ' . htmlspecialchars($span) . ';"' : '';
?>
-
-
-
- = $span ?> data-id="= $file->uuid() ?>" orientation="= $file->orientation() ?>">
-
-
-
= $spanAttr ?> data-id="= $file->uuid() ?>" orientation="= $file->orientation() ?>">
+
+
diff --git a/site/templates/investigations.php b/site/templates/investigations.php
index 4151482..e797c79 100644
--- a/site/templates/investigations.php
+++ b/site/templates/investigations.php
@@ -42,7 +42,13 @@
-
+ $cover,
+ 'alt' => $investigation->title()->value(),
+ 'sizes' => '(min-width: 1000px) 465px, (min-width: 728px) 50vw, 100vw',
+ 'srcsetName' => 'cover-card',
+ 'lazy' => true,
+ ]) ?>