Giter Site home page Giter Site logo

aviarybundle's Introduction

AviaryBundle

##Description

This bundle provides multiple file uploads, based on the BlueImp jQuery file uploader package. It provides also Aviary editing image functionnalities.

##Installation

###Step 1

With Composer:

Add this line in your composer.json file: "appventus/aviary-bundle" : "dev-master"

Declare the bundle in your AppKernel.php: public function registerBundles() { $bundles = array( [...] new AppVentus\AviaryBundle\AviaryBundle(), [...]

###Step 2 : Entity

In your YourEntity.php, add a OneToOne Relation with a Gallery

/**
 * @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;
}

###Step 3 : Form Type

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()) [...] ; } }

###Step 4

Add "aviary.uploadpath" parameter to your config.yml :

parameters:
    aviary.uploadpath: /

And add "AviaryBundle:Form:fields.html.twig" to your twig.yml :

twig:
    form:
        resources:
            - 'AviaryBundle:Form:fields.html.twig'

###Step 5 : Add styles and scripts

If You have installed our AsseticInjectorBundle bundle, add the injector tags :

  • javascripts (injector="aviary_scripts")
  • stylesheets (injector="aviary_styles")

###Step 6 : The Form ! {{ form_start(form, {'method': 'POST', 'attr' : {'id' : 'fileupload'}}) }} {{ form_widget(form.gallery) }} {{ form_rest(form) }} {{ form_end(form) }}

###Step 7 : Main script

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);
    }
});

aviarybundle's People

Contributors

paulandrieux avatar hyukchan avatar gregumo avatar

Stargazers

Kail Zhang avatar  avatar Sébastien Talbot avatar Leny BERNARD avatar

Watchers

Leny BERNARD avatar James Cloos avatar  avatar Charlie Lucas avatar  avatar Sébastien Talbot avatar Sullivan Maxwell avatar  avatar

aviarybundle's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.