alpixel/mediabundle

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

Maintainers

👁 gouaille

Package info

github.com/alpixel/AlpixelMediaBundle

Homepage

Language:JavaScript

Type:symfony-bundle

pkg:composer/alpixel/mediabundle

Statistics

Installs: 7 771

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

2.2.8 2018-01-30 15:03 UTC

Requires

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 4060a643b4cc0996a6636f2b03ef93b19e43d646

  • ALPIXEL <contact.woop@alpixel.fr>

symfonymediaSymfony2bundlealpixel


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.