dev-master
9999999-dev https://github.com/AppVentus/AviaryBundleSymfony AvAviaryBundle
MIT
The Requires
The Development Requires
upload gallery aviary
Symfony AvAviaryBundle
This bundle provides multiple file uploads, based on the BlueImp jQuery file uploader package. It provides also Aviary editing image functionnalities., (*1)
With Composer:, (*2)
Add this line in your composer.json file: "appventus/aviary-bundle" : "dev-master", (*3)
Declare the bundle in your AppKernel.php: public function registerBundles() { $bundles = array( [...] new AppVentus\AviaryBundle\AviaryBundle(), [...], (*4)
In your YourEntity.php, add a OneToOne Relation with a Gallery, (*5)
/** * @ORM\OneToOne(targetEntity="Appventus\AviaryBundle\Entity\Gallery", cascade={"persist"}) */ private $gallery; /** * Set gallery * * @param \Appventus\AviaryBundle\Entity\Gallery $gallery * @return Product */ public function setGallery(\Appventus\AviaryBundle\Entity\Gallery $gallery = null) { $this->gallery = $gallery; return $this; } /** * Get gallery * * @return \Appventus\AviaryBundle\Entity\Gallery */ public function getGallery() { return $this->gallery; }
In your YourEntityType.php, add the GalleryType use Appventus\AviaryBundle\Form\GalleryType; class YourEntityType extends AbstractType { /** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder [...] ->add('gallery', new GalleryType()) [...] ; } }, (*6)
Add "aviary.uploadpath" parameter to your config.yml :, (*7)
parameters: aviary.uploadpath: /
And add "AviaryBundle:Form:fields.html.twig" to your twig.yml :, (*8)
twig: form: resources: - 'AviaryBundle:Form:fields.html.twig'
If You have installed our AsseticInjectorBundle bundle, add the injector tags :, (*9)
{{ form_start(form, {'method': 'POST', 'attr' : {'id' : 'fileupload'}}) }} {{ form_widget(form.gallery) }} {{ form_rest(form) }} <input type="submit" name="submit" value="Submit" /> {{ form_end(form) }}
var featherEditor = new Aviary.Feather({ apiKey: 'yourapikey', apiVersion: 3, theme: 'dark', appendTo: '', language: 'fr', onSave: function(imageID, newURL) { postImage(imageID, newURL); featherEditor.close(); return false; }, onError: function(errorObj) { alert(errorObj.message); } });
Symfony AvAviaryBundle
MIT
upload gallery aviary