*/ class CoverType extends AbstractType { private const int MAX_PIXELS = 20_000_000; public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add('cover', FileType::class, [ 'label' => 'cover_file_header', 'attr' => ['accept' => implode(',', array_keys(CoverStorage::EXTENSIONS))], 'constraints' => [ new NotNull(), new Image( maxSize: '10M', mimeTypes: array_keys(CoverStorage::EXTENSIONS), maxPixels: self::MAX_PIXELS, detectCorrupted: true, ), ], ]) ->add('save', SubmitType::class, ['label' => 'cover_action_upload']); } }