定制 appventus/aviary-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

appventus/aviary-bundle

Composer 安装命令:

composer require appventus/aviary-bundle

包简介

Symfony AvAviaryBundle

README 文档

README

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

统计信息

  • 总下载量: 7.36k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 8
  • Forks: 2
  • 开发语言: HTML

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-11-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固