- Add DISCOVERY_LOG_LEVEL=debug - Add DISCOVERY_SHOW_PROGRESS=true - Temporary changes for debugging InitializerProcessor fixes on production
47 lines
1.1 KiB
PHP
47 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Domain\Media;
|
|
|
|
final readonly class ImageVariantConfig
|
|
{
|
|
public static function getAllVariants(): array
|
|
{
|
|
$variants = [];
|
|
|
|
foreach (ImageVariantType::cases() as $type) {
|
|
foreach ($type->getSizes() as $size) {
|
|
foreach (ImageFormat::cases() as $format) {
|
|
$variants[] = [
|
|
'type' => $type,
|
|
'size' => $size,
|
|
'format' => $format,
|
|
'width' => $size->getWidth($type),
|
|
];
|
|
}
|
|
}
|
|
}
|
|
|
|
return $variants;
|
|
}
|
|
|
|
public static function getVariantsForType(ImageVariantType $type): array
|
|
{
|
|
$variants = [];
|
|
|
|
foreach ($type->getSizes() as $size) {
|
|
foreach (ImageFormat::cases() as $format) {
|
|
$variants[] = [
|
|
'type' => $type,
|
|
'size' => $size,
|
|
'format' => $format,
|
|
'width' => $size->getWidth($type),
|
|
];
|
|
}
|
|
}
|
|
|
|
return $variants;
|
|
}
|
|
}
|