Download the PHP package ldiro/media-bundle without Composer
On this page you can find all versions of the php package ldiro/media-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package media-bundle
artgris/MediaBundle - Easier Symfony Media Management
Prerequisites
- symfony >= 4.1
- artgris/FileManagerBundle
- Assets:
- CSS: bootstrap and Font Awesome
- JS: jQuery, ninsuo/symfony-collection and jQuery UI
Getting Started
-
Download the files:
composer require artgris/media-bundle
-
In
AppKernel.php
add the bundle:new Artgris\Bundle\MediaBundle\ArtgrisMediaBundle()
-
Then, run the following command:
php bin/console assets:install
-
In your twig template, you will then need to import the required assets:
- CSS (requires bootstrap and Font Awesome):
-
JS (requires jQuery, ninsuo/symfony-collection and jQuery UI):
- In
routing.yml
, you will need to import the Ajax route:
Usage
In an entity, add the path attributes as string.
You can also use doctrine's types such as simple_array
, array
, json
for collections.
Then, use a form builder and assigne the MediaType
class for a single file, or the MediaCollectionType
for multiple files.
Options:
MediaType:
'conf' => 'yourconf'
(required) specifies a configuration defined in the FileManager. For more informations about media configurations, refer to FileManagerBundle's documentation'readonly' => false
prevents the user from manually changing the path (it only adds a "readonly" attribute to the corresponding HTML input)'allow_crop' => true
allows the user to edit the image using fengyuanchen/cropper'crop_options' => array
ifallow_crop
is set totrue
, allows to specify extra crop options. The default options:
MediaCollectionType:
'conf' => 'yourconf'
(required) specifies a configuration defined in the FileManager. For more informations about media configurations, refer to FileManagerBundle's documentation
Some ninsuo/symfony-collection's options are available directly:
'min' => 0
'max' => 100
'init_with_n_elements' => 1
'add_at_the_end' => true
Like regular collections, you can edit entries options, i.e to enable alts:
Gregwar Image Bundle Integration
This bundle relies on Gregwar/ImageBundle to crop, mirror and scale images.
If you need to manually crop image in twig (if they are too large for example), instead of using the image
and web_image
functions, you should gImage
, which works the same as image
but improves compatibility.
E.g:
Changing cropping path
add config/packages/artgris_media.yaml
artgris_media:
cropped_path: "cropped/" #default value
Demo Application
MediaBundleDemo is a complete Symfony application created to showcase MediaBundle features.
All versions of media-bundle with dependencies
doctrine/orm Version ^2.5
doctrine/doctrine-bundle Version ~1.0|~2.0
gregwar/image-bundle Version ^2.2
artgris/filemanager-bundle Version ^1.5 || dev-master
symfony/config Version ^4.1
symfony/dependency-injection Version ^4.1
symfony/form Version ^4.1
symfony/framework-bundle Version ^4.1
symfony/http-foundation Version ^4.1
symfony/http-kernel Version ^4.1
symfony/translation Version ^4.1
symfony/validator Version ^4.1