2017 © Pedro Peláez
 

symfony-bundle media-bundle

Media bundle

image

netbull/media-bundle

Media bundle

  • Monday, July 23, 2018
  • by netbull
  • Repository
  • 1 Watchers
  • 0 Stars
  • 145 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 15 Versions
  • 0 % Grown

The README.md

MediaBundle

Build Status
SensioLabsInsight, (*1)

Mod of SonataMediaBundle, (*2)

Installation

Applications that use Symfony Flex

Open a command console, enter your project directory and execute:, (*3)

$ composer require netbull/media-bundle

Applications that don't use Symfony Flex

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:, (*4)

$ composer require netbull/media-bundle

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation., (*5)

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:, (*6)

<?php
// app/AppKernel.php

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

            new NetBull\MediaBundle\NetBullMediaBundle(),
        );

        // ...
    }

    // ...
}

Step 3: Configure the Bundle

Example configuration file app/config/netbull_media.yml, (*7)

parameters:
    quality: 80
    formats:
        tiny: { width: 41, quality: '%quality%' }
        thumb:   { width: 223, quality: '%quality%' }
        normal:   { width: 590, quality: '%quality%' }
        big:   { width: 1280, quality: '%quality%' }

    download:
        strategy: media.security.public_strategy
        mode: http

    default_context:
        download: '%download%'
        providers:
            - media.provider.image
        formats: '%formats%'

netbull_media:
    default_context: 'default'

    providers:
        image:
            service:    media.provider.image
            resizer:    media.resizer.square
            filesystem: media.filesystem.s3
            cdn:        media.cdn.server

        file:
            service:    media.provider.file
            resizer:    false
            filesystem: media.filesystem.s3
            cdn:        media.cdn.server
            thumbnail:  media.thumbnail.format
            allowed_extensions: ['pdf', 'txt', 'rtf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pttx', 'odt', 'odg', 'odp', 'ods', 'odc', 'odf', 'odb', 'csv', 'xml', 'html']
            allowed_mime_types: ['application/pdf', 'application/x-pdf', 'application/rtf', 'text/html', 'text/rtf', 'text/plain']
    cdn:
        server:
            paths:
                - 'YOUR_CDN_DOMAIN'

    filesystem:
        s3:
          defaults: 
            region: eu-central-1 /or other aws zone/
                version: latest
                credentials:
                    key: AWS KEY
                    secret: AWS SECRET
          options:
            bucket: 'AWS BUCKET NAME'
            cache_control:  max-age=604800
            meta:
                Cache-Control: max-age=604800

    contexts:
        default: '%default_context%'

The Versions

23/07 2018
23/07 2018
19/07 2018
18/07 2018
16/07 2018
13/07 2018
12/07 2018
11/07 2018
11/07 2018
11/07 2018
11/07 2018
09/07 2018
08/07 2018
12/06 2018
11/06 2018