, Default-Endung jpg. ext: 'png' für freigestellte Motive,
+ * deren Transparenz JPG zerstören würde (Spielerfoto auf dem Cover).
* ODER array{src: string, width: int, height: int, alt: string} — Originaldatei 1:1
* $sizes string (optional, default '100vw')
* $eager bool (optional) — above the fold: eager + fetchpriority high
@@ -24,15 +26,16 @@ if (!empty($image['src'])): ?>
$widths = $image['widths'];
$largest = max($widths);
+$ext = strtolower((string) ($image['ext'] ?? 'jpg'));
$srcset = implode(', ', array_map(
- static fn (int $w): string => asset("{$image['base']}-{$w}.jpg") . " {$w}w",
+ static fn (int $w): string => asset("{$image['base']}-{$w}.{$ext}") . " {$w}w",
$widths
));
// Maße der größten Variante für width/height (CLS-Vermeidung).
-[$w, $h] = (function () use ($image, $largest): array {
+[$w, $h] = (function () use ($image, $largest, $ext): array {
static $dims = [];
- $file = PUBLIC_PATH . "/assets/{$image['base']}-{$largest}.jpg";
+ $file = PUBLIC_PATH . "/assets/{$image['base']}-{$largest}.{$ext}";
$key = $file;
if (!isset($dims[$key])) {
$size = is_file($file) ? (getimagesize($file) ?: [0, 0]) : [0, 0];
@@ -42,7 +45,7 @@ $srcset = implode(', ', array_map(
})();
?>
- src="= e(asset("{$image['base']}-{$largest}.jpg")) ?>"
+ src="= e(asset("{$image['base']}-{$largest}.{$ext}")) ?>"
srcset="= e($srcset) ?>"
sizes="= e($sizes) ?>"
alt="= e($image['alt']) ?>"
diff --git a/app/components/stadionzeitung-cover.php b/app/components/stadionzeitung-cover.php
index 500c744..e750af6 100644
--- a/app/components/stadionzeitung-cover.php
+++ b/app/components/stadionzeitung-cover.php
@@ -81,7 +81,24 @@ $teaser = trim((string) ($issue['interview']['teaser'] ?? ''));
$heroImage, 'sizes' => '480px', 'class' => 'stadionzeitung-cover__bg']); ?>
-
+ $playerImage, 'width' => 0, 'height' => 0, 'alt' => ''];
+?>
+ $playerBild,
+ 'class' => 'stadionzeitung-cover__player',
+ 'sizes' => '(max-width: 600px) 50vw, 240px',
+ ]); ?>