Package Data | |
---|---|
Maintainer Username: | jooorooo |
Maintainer Contact: | jooorooo@gmail.com (Georgi Nachev) |
Package Create Date: | 2015-10-19 |
Package Last Update: | 2016-02-15 |
Language: | JavaScript |
License: | MIT |
Last Refreshed: | 2024-11-11 15:00:44 |
Package Statistics | |
---|---|
Total Downloads: | 150 |
Monthly Downloads: | 1 |
Daily Downloads: | 1 |
Total Stars: | 2 |
Total Watchers: | 2 |
Total Forks: | 1 |
Total Open Issues: | 0 |
A file upload/editor intended for use with Laravel 5 and CKEditor.
This package is written specifically for Laravel 5, and will integrate seamlessly. The package is based on tsawler/laravel-filemanager.
"intervention/image": "2.*"
Installation is done through composer and packagist. From within your project root directory, execute the following command:
composer require simexis/filemanager
Next run composer update to install the package from packagist:
composer update
Add the ServiceProvider to the providers array in config/app.php:
Simexis\Filemanager\FilemanagerServiceProvider::class,
Add the Facade to the Facades array in config/app.php:
'Filemanager' => Simexis\Filemanager\Facades\Filemanager::class,
Publish the package's config file:
php artisan vendor:publish --tag=sfm_config
Publish the package's public folder assets:
php artisan vendor:publish --tag=sfm_public
If you want to customize the look & feel, then publish the package's views:
php artisan vendor:publish --tag=sfm_views
By default, the package will use its own routes. If you don't want to use those routes, change this entry in config/sfm.php to false:
'use_package_routes' => true,
You will, of course, have to set up your own routes.
If you don't want to use the default image/file directory or url, update the appropriate lines in config/sfm.php:
'dir' => 'public/vendor/filemanager/images/',
'url' => '/vendor/filemanager/images/',
Allowed extension. By default all is enabled. In in config/sfm.php
'allow' => [],
set allowed in array: ['png', 'zip', '...']
Ensure that the files & images directories are writable by your web serber
In the view where you are using a CKEditor instance, use the file uploader by initializing the CKEditor instance as follows:
<script>
CKEDITOR.replace( 'editor', {
filebrowserImageBrowseUrl: '/filemanager',
filebrowserBrowseUrl: '/filemanager'
});
</script>
Here, "editor" is the id of the textarea you are transforming to a CKEditor instance. Note that if
you are using a custom route you will have to change /filemanager
to correspond
to whatever route you have chosen.
Before
</body>
tag add
<?php echo Filemanager::scripts(); ?>
It is important to note that if you use your own routes you must protect your routes to Laravel-Filemanager in order to prevent unauthorized uploads to your server. Fortunately, Laravel makes this very easy.
If, for example, you want to ensure that only logged in users have the ability to access the Laravel-Filemanager, simply wrap the routes in a group, perhaps like this:
Route::group(array('middleware' => ['auth', 'web'], 'namespace' => 'Simexis\Filemanager\controllers'), function () // make sure authenticated
{
// Show SFM
Route::get('/filemanager', ['as' => 'filemanager.show', 'uses' => 'SfmController@show']);
// upload
Route::any('/filemanager/upload', ['as' => 'filemanager.upload', 'uses' => 'UploadController@upload']);
// list images & files
Route::get('/filemanager/json', ['as' => 'filemanager.files', 'uses' => 'ItemsController@getFiles']);
// folders
Route::get('/filemanager/newfolder', ['as' => 'filemanager.newfolder', 'uses' => 'FolderController@getAddfolder']);
Route::get('/filemanager/deletefolder', ['as' => 'filemanager.deletefolder', 'uses' => 'FolderController@getDeletefolder']);
Route::get('/filemanager/folders', ['as' => 'filemanager.folders', 'uses' => 'FolderController@getFolders']);
// crop
Route::get('/filemanager/crop', ['as' => 'filemanager.crop', 'uses' => 'CropController@getCrop']);
Route::get('/filemanager/cropimage', ['as' => 'filemanager.cropimage', 'uses' => 'CropController@getCropimage']);
// rename
Route::get('/filemanager/rename', ['as' => 'filemanager.rename', 'uses' => 'RenameController@getRename']);
// scale/resize
Route::get('/filemanager/resize', ['as' => 'filemanager.resize', 'uses' => 'ResizeController@getResize']);
Route::get('/filemanager/doresize', ['as' => 'filemanager.doresize', 'uses' => 'ResizeController@performResize']);
// download
Route::get('/filemanager/download', ['as' => 'filemanager.download', 'uses' => 'DownloadController@getDownload']);
// delete
Route::get('/filemanager/delete', ['as' => 'filemanager.delete', 'uses' => 'DeleteController@getDelete']);
});
This approach ensures that only authenticated users have access to the Laravel-Filemanager. If you are using Middleware or some other approach to enforce security, modify as needed.
This package is released under the terms of the MIT License.
The MIT License (MIT)
Copyright (c) 2015 Trevor Sawler
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.