Fork from tsawler/laravel-filemanager, add mechanism to restrict users to see only their own folders. The original functions support image and file upload, this package only modifies the image functions.
This package requires "intervention/image": "2.*"
, in order to make thumbs, crop and resize images.
-
Run
composer require intervention/image
-
Run
composer require unisharp/laravel-filemanager
-
Edit
config/app.php
:Add this in service providers
Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider::class, Intervention\Image\ImageServiceProvider::class,
And add this in class aliases
'Image' => Intervention\Image\Facades\Image::class,
-
Publish the package's config and assets :
php artisan vendor:publish --tag=lfm_config php artisan vendor:publish --tag=lfm_public
-
Fill user_field with your user slug in config/lfm.php :
'user_field' => "\Auth::user()->name",
-
View initiation
<script> CKEDITOR.replace( 'editor', { filebrowserImageBrowseUrl: '/laravel-filemanager?type=Images' }); </script>
Or initiate using ckeditor jquery adapter
<script> $('textarea').ckeditor({ filebrowserImageBrowseUrl: '/laravel-filemanager?type=Images' }); </script>
-
Ensure that the files & images directories are writable by your web server
-
To use your own route, edit config/lfm.php :
'use_package_routes' => false,
-
To disable multi-user mechanism, dit config/lfm.php :
'allow_multi_user' => false,
-
To specify upload directory, edit config/lfm.php :
'images_dir' => 'public/vendor/laravel-filemanager/images/', 'images_url' => '/vendor/laravel-filemanager/images/',
-
If the route is changed, make sure
filebrowserImageBrowseUrl
is correspond to your route :<script> CKEDITOR.replace( 'editor', { filebrowserImageBrowseUrl: '/your-custom-route?type=Images' }); </script>
And be sure to include the
?type=Images
parameter. -
To customize the views, run
php artisan vendor:publish --tag=lfm_views