Two methods are available for setting up this bundle:
- Using basic configuration explained here
- Using a service for a most advanced configuration
Option | Type | Required |
---|---|---|
conf |
Array |
True |
Example:
artgris_file_manager:
conf:
public: ...
myprivatefolder: ...
onlypdf: ...
anystring: ...
...
Option | Type | Required |
---|---|---|
dir |
String |
True |
Example with a Public folder :
artgris_file_manager:
conf:
public:
dir: '%kernel.project_dir%/public/uploads'
Browse the
/manager/?conf=public
URL to get access to this File Manager
"%kernel.project_dir%/web/" or "%kernel.project_dir%/public/" (symfony 4) in dir path are required to get 'public' image urls otherwise filemanager thinks it's a private directory.
Example with a Private folder :
artgris_file_manager:
conf:
private:
dir: '%kernel.project_dir%/private'
Browse the
/manager/?conf=private
URL to get access to this File Manager
Option | Type | Required | Default value |
---|---|---|---|
tree |
Booleen |
False | true |
Example with tree
= false
Option | Type | Required | Possible values | Default value |
---|---|---|---|---|
view |
String |
False | thumbnail , list |
list |
Example with thumbnail
Option | Type | Required | Possible values | Default value |
---|---|---|---|---|
type |
String |
False | file , image , media |
file |
Example:
artgris_file_manager:
conf:
public:
...
type: 'media'
Regex rules used:
media
: /\.(mp4|ogg|webm)$/i
Accept basic HTML video media types (.mp4, .ogg and .webm)
image:
: /\.(gif|png|jpe?g|svg)$/i
Accept basic HTML image types (.gif, .png, .jpg, .jpeg and .svg)
file
: /.+$/i
Accept all files with an extension (.pdf, .html, ...)
If
type
option is not sufficient for you, You can defined your ownregex
rules andaccept
(HTML input accept attribute):
Option | Type | Required | Default value |
---|---|---|---|
regex |
String |
False | |
accept |
String |
False | only if you used the media option (see below) |
The
regex
option overridemedia
option
- Example: This File Manger Example accepts only .jpeg and .jpg files
artgris_file_manager:
conf:
public:
...
regex: '.(jpe?g)$'
accept: '.jpeg,.jpg'
accept
default values used with media
:
Media | Default accept value |
---|---|
file |
- |
image |
image/* |
media |
video/* |
It is recommended to combine
regex
option withaccept
option for a better user experience
Option | Type | Required | Default value |
---|---|---|---|
twig_extension |
string |
False |
'$IMAGE$' in string will be replace by image path.
artgris_file_manager:
conf:
public:
...
twig_extension: "resize($IMAGE$)" // Twig function example
twig_extension: "web_image($IMAGE$).zoomCrop(22, 22)" // Twig function (Gregwar/ImageBundle) example
twig_extension: "$IMAGE$|resize" // Twig filter example
Option | Type | Required | Default value |
---|---|---|---|
cachebreaker |
bool |
False | True |
Adding a cachebreaker ?time=RANDOM_NUMBER or & &time=RANDOM_NUMBER at the end of the images (preview) url. It's removed if you have used "twig_extension" option.
Option | Type | Required | Default value |
---|---|---|---|
show_file_count |
bool |
False | True |
Having a large number of files in a (sub-)directory can have a huge impact on performance, setting this to false will improve the performance at the cost of the display of files per directory
Option | Type | Required | Default value |
---|---|---|---|
root_name |
string |
False | null |
upload
A non-exhaustive configuration of the File Upload widget blueimp/jQuery-File-Upload
Exhaustive options can only be defined with The service configuration
Option | Type | Required |
---|---|---|
upload |
Array |
False |
Example
artgris_file_manager:
conf:
public:
upload:
max_file_size: 1048576 # (1Mo) size in bytes
max_width: 1024
max_height: 768
image_library: 1
...
Option | Type | Required | Default value | Description | Possible values |
---|---|---|---|---|---|
min_file_size |
Interger |
False | 1 | Min allowed file size (bytes) | |
max_file_size |
Interger |
False | null | Max allowed file size (bytes) | |
max_width |
Interger |
False | null | Max allowed file width (px) | |
max_height |
Interger |
False | null | Max allowed file height (px) | |
min_width |
Interger |
False | 1 | Min allowed file width (px) | |
min_height |
Interger |
False | 1 | Min allowed file height (px) | |
image_library |
Interger |
False | 1 | Image library |
|
image_versions |
Array |
False | {'' : {'auto_orient' : true}} | Array of image versions you need |
if you need thumbmail, or another format for the original image you have following option :
Option | Type | Required | Default value | Description |
---|---|---|---|---|
auto_orient |
Booleen |
False | true | Automatically rotate images based on EXIF meta data |
crop |
Booleen |
False | false | If you need to crop image |
max_width |
Interger |
False | null | Max width after resize/crop (px) |
max_height |
Interger |
False | null | Max height after resize/crop (px) |
The key determines whether you save only the version of the image or whether you save the original and the version of the image in a subfolder (subfolder name = key name)
Example with original image + thumbmail 80px x 80px
artgris_file_manager:
conf:
public:
upload:
image_library: 3
image_versions: {'thumbnail': {max_width: 80, max_height: 80}}
this configuration create a thumbnail folder under current path with thumbnails
Example with 100px x 100px image
artgris_file_manager:
conf:
public:
upload:
image_library: 3
image_versions: {'': {max_width: 100, max_height: 100}}
this configuration only saves the version of the image in the current folder.
Complexe example with multiple image sizes:
This example saved 4 images:
- original
- medium: crop image 200px x 600px
- thumbnail: a thumbnail 80px x 80px
- miniThumbnail: a mini thumbnail 10px x 10px
artgris_file_manager:
conf:
public:
upload:
image_library: 3
image_versions: {'medium': {crop: true, max_width: 200, max_height: 600}, 'thumbnail': {max_width: 80, max_height: 80}, 'miniThumbnail': {max_width: 10, max_height: 10}}
artgris_file_manager:
conf:
public:
dir: '%kernel.project_dir%/public/uploads'
type: 'image'
upload:
max_file_size: 1048576 # (1Mo) size in bytes
max_width: 1024
max_height: 768
private:
dir: '%kernel.project_dir%/private'
upload:
image_versions: {'medium': {crop: true, max_width: 200, max_height: 600}, 'thumbnail': {max_width: 80, max_height: 80}, 'miniThumbnail': {max_width: 10, max_height: 10}}
tiny:
dir: '%kernel.project_dir%/public/uploads'
min_width: 80
min_height: 80
upload:
image_versions:
{'': {max_width: 800, max_height: 600}, 'thumbnail': {max_width: 80, max_height: 80}}
Overwrite an existing file with the same name (included image_versions):
artgris_file_manager:
conf:
public:
dir: '%kernel.project_dir%/public/uploads'
upload:
override: true