定制 alpixel/mediabundle 二次开发

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

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

alpixel/mediabundle

Composer 安装命令:

composer require alpixel/mediabundle

包简介

The AlpixelMediaBundle is a bundle managing media of all kinds for our projects.

README 文档

README

SensioLabsInsight Build Status StyleCI Scrutinizer Code Quality Latest Stable Version

The AlpixelMediaBundle is a bundle managing media of all kinds for our projects.

Installation

  • Install the package
composer require 'alpixel/mediabundle:~2.0'
  • Update AppKernel.php

    <?php
    // app/AppKernel.php

    // ...
    class AppKernel extends Kernel
    {
        public function registerBundles()
        {
            $bundles = array(
                // ...

                new Alpixel\Bundle\MediaBundle\AlpixelMediaBundle(),
            );

            // ...
        }

        // ...
    }
  • Update DB Schema
php app/console doctrine:schema:update
  • Update your config.yml
twig:
    ...
    form:
        resources:
            - 'AlpixelMediaBundle:Form:fields.html.twig'


alpixel_media:
    upload_folder: "%kernel.root_dir%/../web/upload/"
    allowed_mimetypes: ['image/*', 'application/pdf']
    
liip_imagine:
    resolvers:
        default:
            web_path:
                web_root: %alpixel_media.upload_folder%
                cache_prefix: filters
    filter_sets:
        cache: ~
        admin:
            quality: 100
            filters:
                auto_rotate: ~
                thumbnail: { size: [140, 93], mode: outbound }
  • Add the routing
alpixel_media:
    resource: '@AlpixelMediaBundle/Resources/config/routing.yml'
  • Use it in front

There is a twig extension capable of generating URLs, you can call it this way :

<img src='{{myMedia|media_url}}' />
<img src='{{myMedia|media_url({public: false})}}' />

Available options are :

  • public : [true]/false should the url be SEO friendly or not ?
  • absolute : true/[false] should the URL be relative or not ?
  • action : [show]/download what kind of action is expected.
  • filter : the liip imagine filter used to render the image. Defaults to null (the original one)

You can also generate the URL by hand. Just look at the MediaController@showMediaAction to see what are the URL expected.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-01-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固