dev-master
9999999-devSymfony2 bundle for files uploading and images processing
MIT
The Requires
by Contributors
symfony upload crop images
Wallogit.com
2017 © Pedro Peláez
Symfony2 bundle for files uploading and images processing
Basics, (*1)
composer require zmc/image-bundle:dev-master
Place new line into AppKernel:, (*3)
``` php <?php // app/AppKernel.php, (*4)
public function registerBundles() { $bundles = array( // ... new Liip\ImagineBundle\LiipImagineBundle(), new Zmc\ImageBundle\ZmcImageBundle(), ); // ... }, (*5)
### Step 3) Import routing: ``` yml # app/config/routing.yml # some routes can go here... zmc_image: resource: "@ZmcImageBundle/Resources/config/routing.xml" prefix: /zmc-image # ... and some can go here. It's doesen't matter
Firstly you need to create FormType class and just use our form type as field:, (*7)
``` php <?php // src/Acme/DemoBundle/Form/Type/DemoType.php, (*8)
// ... /** * {@inheritdoc} */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('image', 'file_upload_hidden', array(, (*9)
/* required parameters */
'save_path' => '/../web/uploads',
'web_path' => '/uploads',
/* optional parameters */
'imagine_filter' => 'thumb', // filter name configured for LiipImagineBundle
/* acceptable files to upload. Patterns and acceptable parameters you can see there http://www.w3schools.com/tags/att_input_accept.asp */
'accept_file_type' => 'image/*',
// here provided default value, you can pass any service name which implements
/* \Zmc\ImageBundle\Form\Handler\HandlerInterface */
'handler' => 'zmc_image.form.handler.upload',
))
;
}
// ... ```, (*10)
Symfony2 bundle for files uploading and images processing
MIT
symfony upload crop images