Leite Website-Bilder bis 2400 px statt in Vorschaugröße ab.

Ein Bild (Ausgabeart „bild“) dient über die Website-Freigabe auch als Einstieg und Abschnittshintergrund;
640 px wären bei 1440 px Fensterbreite sichtbar unscharf. Bilder werden nie vergrößert, transparente
Flächen werden weiß. Filmstandbilder und Modulvorschauen bleiben bei 640 px.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Opus 5.5 committed 2026-11-18 22:13:12 +01:00
1 parent 13530b8171
commit 7c63424ea6
2 files changed
+75 -1

No files matched your search

+7 -1
View File
@@ -291,9 +291,15 @@ private function still(ContentElement|Composition $subject, Filesystem $disk, st
$width = imagesx($image);
$height = imagesy($image);
$targetWidth = 640;
// Bilder (Ausgabeart „bild“) dienen auch als Website-Ableitung für Einstieg und Hintergrund. 640 px wären dort
// sichtbar unscharf; deshalb bis 2400 px, nie vergrößert. Filmstandbilder und Modulvorschauen bleiben bei 640 px.
$targetWidth = $subject instanceof ContentElement && $subject->output_class === 'bild'
? max(1, min(2400, $width))
: 640;
$targetHeight = (int) max(1, round($height * ($targetWidth / max(1, $width))));
$canvas = imagecreatetruecolor($targetWidth, $targetHeight);
// Transparente Flächen (PNG, GIF) werden im JPEG weiß statt schwarz.
imagefill($canvas, 0, 0, (int) imagecolorallocate($canvas, 255, 255, 255));
imagecopyresampled($canvas, $image, 0, 0, 0, 0, $targetWidth, $targetHeight, $width, $height);
ob_start();
imagejpeg($canvas, null, 82);