PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, July 22, 2022

[FIXED] How to get image preview in symfony collection images

 July 22, 2022     doctrine-orm, html, jquery, php-5.4, symfony-2.3     No comments   

Issue

I am working with SonataAdminBundle in a symfony2 project in which my admin class is as given below :

class ApartmentsAdmin extends Admin
 {
     protected function configureFormFields(FormMapper $formMapper)
      {
         ->add('images', 'collection', array(
                'type' => new ImageType(),
                'allow_add' => true,
                'allow_delete' => true,
                'by_reference' => true,
                'mapped' => true,
                'label' => false,
                'required' => false,
                'label' => 'Apartment Images'
              ));
           }
       }

It works fine ; but my issue is that , on edit page i want to let see preview of each images included in collection of images. In documentation of "SonataAdminBundle" image preview is given for one individual image , but how is it possible to make preview for collection images ..

Please suggest me..

Thanks a lot ..


Solution

Finally i am able to do this through "custom Form Type Extension" for which documentation is given on the link "http://symfony.com/doc/current/cookbook/form/create_form_type_extension.html" .



Answered By - Ajeet Varma
Answer Checked By - Pedro (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing