Download the PHP package artgris/media-bundle without Composer
On this page you can find all versions of the php package artgris/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
Repository is no longer maintained. A more modern alternative of this bundle exists: Arkounay ux-media bundle - Symfony UX async document upload type using ArtgrisFileManager : https://github.com/Arkounay/ux-media
Prerequisites
- symfony >= 4.1
- artgris/FileManagerBundle
- Assets:
- CSS: bootstrap 4 or 5 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'extra' => []
(only with FileManagerBundle Service Configuration) Extra Url parameters injections'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:
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.8|^2.0
gregwar/image Version 2.*
artgris/filemanager-bundle Version >=2.0.0