Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Mediabundle Laravel Package

alpixel/mediabundle

View on GitHub
Deep Wiki
Context7

AlpixelMediaBundle

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.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
headercat/phpstan-extension-ide-helper
yosymfony/parser-utils
innmind/black-box
babenkoivan/elastic-migrations
babenkoivan/elastic-adapter
sandermuller/package-boost-php
sandermuller/boost-core
depa/sulu-google-reviews-bundle
croct/plug-symfony
develia/commons
dmstr/symfony-system-resources-bundle
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
renatomarinho/laravel-page-speed
develia/geo-bundle
austinheap/laravel-database-encryption
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
imbo/imbo-coding-standard