Skip to content

Commit 0d90b0f

Browse files
Willem Leuverinkstreamtw
authored andcommitted
Update config.md (#314)
* Update config.md Updated with newest version of lfm.php code & added extra info concerning the php.ini override array * Update lfm.php Added notice of php_ini_override limitations to the configuration file. * Update lfm.php
1 parent 367c7c0 commit 0d90b0f

File tree

2 files changed

+62
-8
lines changed

2 files changed

+62
-8
lines changed

docs/config.md

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ In `config/lfm.php` :
1717
// The url to this package. Change it if necessary.
1818
'prefix' => 'laravel-filemanager',
1919

20+
// The prefix of urls to non-public files, for exmaple if: base_directory !== 'public'
21+
// Without slashes
22+
'urls_prefix' => '',
23+
2024
/*
2125
|--------------------------------------------------------------------------
2226
| Multi-User Mode
@@ -25,10 +29,15 @@ In `config/lfm.php` :
2529

2630
// If true, private folders will be created for each signed-in user.
2731
'allow_multi_user' => true,
32+
// If true, share folder will be created when allow_multi_user is true.
33+
'allow_share_folder' => true,
2834

29-
// The database column to identify a user. Make sure the value is unique.
30-
// Ex: When set to 'id', the private folder of user will be named as the user id.
31-
'user_field' => 'id',
35+
// Flexibla way to customize client folders accessibility
36+
// Ex: The private folder of user will be named as the user id.
37+
// You cant use a closure when using the optimized config file (in Laravel 5.2 anyway)
38+
'user_field' => function() {
39+
return auth()->user()->id;
40+
},
3241

3342
/*
3443
|--------------------------------------------------------------------------
@@ -72,15 +81,22 @@ In `config/lfm.php` :
7281
// If true, non-alphanumeric folder name will be rejected.
7382
'alphanumeric_directory' => false,
7483

75-
'max_image_size' => 500,
76-
'max_file_size' => 1000,
84+
// If true, the uploading file's size will be verified for over than max_image_size/max_file_size.
85+
'should_validate_size' => false,
86+
87+
'max_image_size' => 50000,
88+
'max_file_size' => 50000,
89+
90+
// If true, the uploading file's mime type will be valid in valid_image_mimetypes/valid_file_mimetypes.
91+
'should_validate_mime' => false,
7792

7893
// available since v1.3.0
7994
'valid_image_mimetypes' => [
8095
'image/jpeg',
8196
'image/pjpeg',
8297
'image/png',
83-
'image/gif'
98+
'image/gif',
99+
'image/svg+xml',
84100
],
85101

86102
// available since v1.3.0
@@ -90,10 +106,20 @@ In `config/lfm.php` :
90106
'image/pjpeg',
91107
'image/png',
92108
'image/gif',
109+
'image/svg+xml',
93110
'application/pdf',
94111
'text/plain',
95112
],
96113

114+
/*
115+
|--------------------------------------------------------------------------
116+
| Image / Folder Setting
117+
|--------------------------------------------------------------------------
118+
*/
119+
120+
'thumb_img_width' => 200,
121+
'thumb_img_height' => 200,
122+
97123
/*
98124
|--------------------------------------------------------------------------
99125
| File Extension Information
@@ -129,4 +155,28 @@ In `config/lfm.php` :
129155
'ppt' => 'fa-file-powerpoint-o',
130156
'pptx' => 'fa-file-powerpoint-o',
131157
],
158+
159+
/*
160+
|--------------------------------------------------------------------------
161+
| php.ini override
162+
|--------------------------------------------------------------------------
163+
*/
164+
// These values override your php.ini settings before uploading files
165+
// Set these to false to ingnore and apply your php.ini settings
166+
'php_ini_overrides' => [
167+
'memory_limit' => '256M'
168+
],
132169
```
170+
171+
## Caveats
172+
### php.ini overrides
173+
174+
The php_ini_overrides are applied on every request the filemanager does and are reset once the script has finished executing.
175+
This has one drawback: any ini settings that you might want to change that apply to the request itself will not work.
176+
177+
For example, overriding these settings will not work:
178+
* upload_max_filesize
179+
* post_max_size
180+
181+
**Why this is expected behaviour:**
182+
upload_max_filesize and post_max_size will get set but uploaded files are already passed to your PHP script before the settings are changed.

src/config/lfm.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,13 @@
160160
|--------------------------------------------------------------------------
161161
| php.ini override
162162
|--------------------------------------------------------------------------
163+
|
164+
| These values override your php.ini settings before uploading files
165+
| Set these to false to ingnore and apply your php.ini settings
166+
|
167+
| Please note that the 'upload_max_filesize' & 'post_max_size'
168+
| directives are not supported.
163169
*/
164-
// These values override your php.ini settings before uploading files
165-
// Set these to false to ingnore and apply your php.ini settings
166170
'php_ini_overrides' => [
167171
'memory_limit' => '256M'
168172
]

0 commit comments

Comments
 (0)