Enable Discovery debug logging for production troubleshooting
- Add DISCOVERY_LOG_LEVEL=debug - Add DISCOVERY_SHOW_PROGRESS=true - Temporary changes for debugging InitializerProcessor fixes on production
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Domain\Media;
|
||||
@@ -36,7 +37,7 @@ final readonly class ImageSourceSetGenerator
|
||||
$attributes['width'] = $fallbackImage->width;
|
||||
$attributes['height'] = $fallbackImage->height;
|
||||
|
||||
if (!isset($attributes['alt'])) {
|
||||
if (! isset($attributes['alt'])) {
|
||||
$attributes['alt'] = '';
|
||||
}
|
||||
|
||||
@@ -114,6 +115,11 @@ final readonly class ImageSourceSetGenerator
|
||||
{
|
||||
$variantsByFormat = [];
|
||||
|
||||
// Check if variants are loaded to avoid uninitialized readonly property error
|
||||
if (! isset($image->variants)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
foreach ($image->variants as $variant) {
|
||||
if ($variant->variantType === $variantType) {
|
||||
$variantsByFormat[$variant->format][] = $variant;
|
||||
@@ -133,15 +139,16 @@ final readonly class ImageSourceSetGenerator
|
||||
private function getFallbackImage(array $variantsByFormat, Image $image): ImageVariant
|
||||
{
|
||||
// Bevorzugen JPEG als Fallback
|
||||
if (isset($variantsByFormat['jpeg']) && !empty($variantsByFormat['jpeg'])) {
|
||||
if (! empty($variantsByFormat['jpeg'])) {
|
||||
// Mittlere Größe als Fallback verwenden
|
||||
$variants = $variantsByFormat['jpeg'];
|
||||
|
||||
return $variants[min(1, count($variants) - 1)];
|
||||
}
|
||||
|
||||
// Alternativen, falls kein JPEG verfügbar
|
||||
foreach (['webp', 'avif'] as $format) {
|
||||
if (isset($variantsByFormat[$format]) && !empty($variantsByFormat[$format])) {
|
||||
if (! empty($variantsByFormat[$format])) {
|
||||
return $variantsByFormat[$format][0];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user