Easy admin - Show preview images for CollectionField

123 views Asked by At

I'm on symfony 5 and easy admin 3. I have the controller ProductCrudController with the following field:

CollectionField::new('productImages', 'Product Images')
    ->setEntryType(ProductImageType::class)
    ->setFormTypeOption('by_reference', false)
    ->setFormTypeOption('allow_add', true)
    ->setFormTypeOption('prototype', true)
    ->onlyOnForms()

I'd like to display a preview of the selected images before submitting my form. How can I do this? Please

Ive tried this:

CollectionField::new('productImages', 'Images du produit')
    ->setEntryType(ProductImageType::class)
    ->setFormTypeOption('by_reference', false)
    ->setFormTypeOption('allow_add', true)
    ->setFormTypeOption('prototype', true)
    ->setCustomOption('allow_file_upload', true)
    ->setCustomOption('show_preview', true)
    ->setCustomOption('preview_uri', 'getPreviewImage')
    ->onlyOnForms()

But it is not OK

0

There are 0 answers