dev-master
9999999-dev http://github.com/anime-db/form-type-image-bundleImage upload form type
MIT
The Requires
- php >=5.4.0
- symfony/symfony >=2.8.0
The Development Requires
by Anime DB
php form image
Image upload form type
Pretty simple with Composer, run:, (*2)
composer require anime-db/form-type-image-bundle
Add FormTypeImageBundle to your application kernel, (*3)
// app/AppKernel.php public function registerBundles() { return array( // ... new AnimeDb\Bundle\FormTypeImageBundle\AnimeDbFormTypeImageBundle(), // ... ); }
Default config, (*4)
anime_db_cache_time_keeper: web_path: '/upload/' # Upload images directory: %kernel.root_dir%/../web/upload/ authorized: true # Only authorized users can upload images constraint: files_limit: 10 # Limiting the number of simultaneous file upload max_size: null # Max file size. Example: 2M min_width: 0 # Minimum image width min_height: 0 # Minimum image height max_width: 0 # Maximum image width max_height: 0 # Maximum image height
Add form template, (*5)
twig: form: resources: [ 'AnimeDbFormTypeImageBundle:Form:fields.html.twig' ]
Add form templates for SonataDoctrineORMAdminBundle, (*6)
sonata_doctrine_orm_admin: templates: form: [ 'AnimeDbFormTypeImageBundle:Form:sonata_admin_fields.html.twig' ]
use AnimeDb\Bundle\FormTypeImageBundle\Form\Type\ImageType; use AnimeDb\Bundle\FormTypeImageBundle\Form\Type\ImageCollectionType; $form = $this ->createFormBuilder() ->add('cover', ImageType::class) ->add('covers', ImageCollectionType::class);
Image upload form type
MIT
php form image