Symfony2 Image Form Field Bundle, extends FileFieldBundle
This code is part of the SymfonyContrib community.
Extends the FileFieldBundle to provide additional image specific functionality.
- Image preview.
- ...more to come.
Installation is similar to a standard bundle. http://symfony.com/doc/current/cookbook/bundles/installation.html
- Add bundle to composer.json: https://packagist.org/packages/symfonycontrib/imagefield-bundle
- Add bundle to AppKernel.php:
- jQuery is required but not provided by this bundle.
- Include JS files (after FileField JS files):
You can simple replace any FileField with an ImageField by changing the field type to 'imagefield'. All options and features of FileField still apply.
$builder->add('photo', 'imagefield', [ ... ]);