Download the PHP package donjohn/media-bundle without Composer
On this page you can find all versions of the php package donjohn/media-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download donjohn/media-bundle
More information about donjohn/media-bundle
Files in donjohn/media-bundle
Package media-bundle
Short Description a simple media bundle inspired by sonata media bundle
License MIT
Homepage https://github.com/Donjohn/MediaBundle
Informations about the package media-bundle
Give credits to Sonata, they inspired this bundle.
Installation
Composer
Minimal configuration
Create a new class and extends it with Donjohn\MediaBundle\Media
LiipImagineBundle
Add this to your config.yml
See LiipImagineBundle Configuration for liip filters configuration
Optional configuration
Change folder for uploaded files
Restrict uploaded file size
Providers
Available providers :
- image
- file
Usage
To insert a media in the twig, use the block with an optional filter name, defined in the liip_imagine.filter_sets section. If you don't provider a filter name, 'reference' filter is default. it will return the original media uploaded with any filter or post processing.
You can also pass class/width/height/alt options to the media rendering:
FormType
An Donjohn\MediaBundle\Form\Type\MediaType is available
provider option default value is null. A guesser will try on the fly to detect the best provider fo each file unless you define the option. The default guess is 'file'.
Set 'allow_delete' option to false if you don't want to allow removing media from an entity. It removes the unlink checkbox in the form.
Set 'create_on_update' option to true if you don't want to update the current media when uploading a file but rather create a new media instead. Old one is not removed.
If you want to upload a collection of Medias set multiple to true.
OneupUploader
For very large files, the bundle includes the Fine Uploader feature thanks to OneUpUploaderBundle.
Don't forget to install fineuploader (bower/npm/...) and include the css/js in your layout (fix path if needed).
Add the OneupUploaderBundle to your AppKernel.php
And to config.yml, add:
You can change the uploaded chunk size or the template used to render the fineuploader frame
Custom MediaProvider
To implement your own provider, extends the BaseProvider and redefine abstract function.
Autowiring should do the job...
Api platform
The bundle is compatible with APIPlatform.
All versions of media-bundle with dependencies
ext-gd Version *
ext-mbstring Version *
ext-fileinfo Version *
doctrine/doctrine-bundle Version ^1.6
symfony/form Version ^3.4 || ^4.1
symfony/framework-bundle Version ^3.4 || ^4.1
symfony/security-bundle Version ^3.4 || ^4.1
symfony/twig-bundle Version ^3.4 || ^4.1
symfony/filesystem Version ^3.4 || ^4.1
symfony/validator Version ^3.4 || ^4.1
twig/twig Version ^1.28 || ^2.0
symfony/templating Version ^3.4 || ^4.1