update v 1.0.7.5

This commit is contained in:
Sujit Prasad
2016-06-13 20:41:55 +05:30
parent aa9786d829
commit 283d97e3ea
5078 changed files with 339851 additions and 175995 deletions

View File

@@ -0,0 +1,67 @@
## Documents
1. [Installation](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/installation.md)
1. [Intergration](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/integration.md)
1. [Config](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/config.md)
1. [Customization](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/customization.md)
## Config
In `config/lfm.php` :
```php
'rename_file' => true,
// true : files will be renamed as uniqid
// false : files will remain original names
// true : filter filename characters which are not alphanumeric, and replace them with '_'
'alphanumeric_filename' => true,
'use_package_routes' => true,
// set this to false to customize route for file manager
'middlewares' => ['auth'],
// determine middlewares that apply to all file manager routes
// NOTE: for laravel 5.2, please use ['web', 'auth']
'allow_multi_user' => true,
// true : user can upload files to shared folder and their own folder
// false : all files are put together in shared folder
'user_field' => 'id',
// determine which column of users table will be used as user's folder name
'shared_folder_name' => 'shares',
// the name of shared folder
'thumb_folder_name' => 'thumbs',
// the name of thumb folder
'images_dir' => 'public/photos/',
'images_url' => '/photos/',
// path and url of images
'files_dir' => 'public/files/',
'files_url' => '/files/',
// path and url of files
// valid image mimetypes
'valid_image_mimetypes' => [
'image/jpeg',
'image/pjpeg',
'image/png',
'image/gif'
],
// valid file mimetypes (only when '/laravel-filemanager?type=Files')
'valid_file_mimetypes' => [
'image/jpeg',
'image/pjpeg',
'image/png',
'image/gif',
'application/pdf',
'text/plain'
],
```

View File

@@ -0,0 +1,48 @@
## Documents
1. [Installation](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/installation.md)
1. [Intergration](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/integration.md)
1. [Config](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/config.md)
1. [Customization](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/customization.md)
## Customization
Feel free to customize the routes and views if your need.
### Routes
1. Copy the routes in /vendor/unisharp/laravel-filemanager/src/routes.php
1. Make sure urls below is correspond to your route :
CKEditor
```javascript
<script>
CKEDITOR.replace( 'editor', {
filebrowserImageBrowseUrl: '/your-custom-route?type=Images',
filebrowserBrowseUrl: '/your-custom-route?type=Files',
});
</script>
```
And be sure to include the `?type=Images` or `?type=Files` parameter.
TinyMCE
```javascript
...
var cmsURL = editor_config.path_absolute + 'your-custom-route?field_name='+field_name+'&lang='+ tinymce.settings.language;
if (type == 'image') {
cmsURL = cmsURL + "&type=Images";
} else {
cmsURL = cmsURL + "&type=Files";
}
...
```
### Views
1. Copy the views from /vendor/unisharp/laravel-filemanager/src/views/ :
```bash
php artisan vendor:publish --tag=lfm_views
```

View File

@@ -0,0 +1,49 @@
## Documents
1. [Installation](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/installation.md)
1. [Intergration](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/integration.md)
1. [Config](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/config.md)
1. [Customization](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/customization.md)
## Requirements
* php >= 5.5
* Laravel 5
* requires [intervention/image](https://github.com/Intervention/image) (to make thumbs, crop and resize images).
## Notes
* For `laravel 5.2`, please set `'middlewares' => ['web', 'auth'],` in config/lfm.php
* With laravel-filemanager >= 1.3.0, the new configs `valid_image_mimetypes` and `valid_file_mimetypes` restrict the MIME types of the uploading files.
## Installation
1. Install package
```bash
composer require unisharp/laravel-filemanager
```
1. Edit `config/app.php` :
Add service providers
```php
Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider::class,
Intervention\Image\ImageServiceProvider::class,
```
And add class aliases
```php
'Image' => Intervention\Image\Facades\Image::class,
```
1. Publish the package's config and assets :
```bash
php artisan vendor:publish --tag=lfm_config
php artisan vendor:publish --tag=lfm_public
```
1. Ensure that the files & images directories (in `config/lfm.php`) are writable by your web server.

View File

@@ -0,0 +1,123 @@
## Documents
1. [Installation](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/installation.md)
1. [Intergration](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/integration.md)
1. [Config](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/config.md)
1. [Customization](https://github.com/UniSharp/laravel-filemanager/blob/master/doc/customization.md)
## WYSIWYG Editor Integration:
### Option 1: CKEditor
1. Install [laravel-ckeditor](https://github.com/UniSharp/laravel-ckeditor) package
1. Modify the views
Sample 1 - Replace by ID:
```html
<script src="/vendor/unisharp/laravel-ckeditor/ckeditor.js"></script>
<textarea id="my-editor" name="content" class="form-control">{!! old('content', $content) !!}</textarea>
<script>
CKEDITOR.replace( 'my-editor', {
filebrowserImageBrowseUrl: '/laravel-filemanager?type=Images',
filebrowserImageUploadUrl: '/laravel-filemanager/upload?type=Images&_token={{csrf_token()}}',
filebrowserBrowseUrl: '/laravel-filemanager?type=Files',
filebrowserUploadUrl: '/laravel-filemanager/upload?type=Files&_token={{csrf_token()}}'
});
</script>
```
Sample 2 - With JQuery Selector:
```html
<script src="/vendor/unisharp/laravel-ckeditor/ckeditor.js"></script>
<script src="/vendor/unisharp/laravel-ckeditor/adapters/jquery.js"></script>
<textarea name="content" class="form-control my-editor">{!! old('content', $content) !!}</textarea>
<script>
$('textarea.my-editor').ckeditor({
filebrowserImageBrowseUrl: '/laravel-filemanager?type=Images',
filebrowserImageUploadUrl: '/laravel-filemanager/upload?type=Images&_token={{csrf_token()}}',
filebrowserBrowseUrl: '/laravel-filemanager?type=Files',
filebrowserUploadUrl: '/laravel-filemanager/upload?type=Files&_token={{csrf_token()}}'
});
</script>
```
### Option 2: TinyMCE4
```html
<script src="//cdn.tinymce.com/4/tinymce.min.js"></script>
<textarea name="content" class="form-control my-editor">{!! old('content', $content) !!}</textarea>
<script>
var editor_config = {
path_absolute : "/",
selector: "textarea",
plugins: [
"advlist autolink lists link image charmap print preview hr anchor pagebreak",
"searchreplace wordcount visualblocks visualchars code fullscreen",
"insertdatetime media nonbreaking save table contextmenu directionality",
"emoticons template paste textcolor colorpicker textpattern"
],
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media",
relative_urls: false,
file_browser_callback : function(field_name, url, type, win) {
var x = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth;
var y = window.innerHeight|| document.documentElement.clientHeight|| document.getElementsByTagName('body')[0].clientHeight;
var cmsURL = editor_config.path_absolute + 'laravel-filemanager?field_name=' + field_name;
if (type == 'image') {
cmsURL = cmsURL + "&type=Images";
} else {
cmsURL = cmsURL + "&type=Files";
}
tinyMCE.activeEditor.windowManager.open({
file : cmsURL,
title : 'Filemanager',
width : x * 0.8,
height : y * 0.8,
resizable : "yes",
close_previous : "no"
});
}
};
tinymce.init(editor_config);
</script>
```
##Independent use
If you are going to use filemanager independently, meaning set the value of an input to selected photo/file url, follow this structure:
1. Create a button, input, and image preview holder if you are going to choose images.
Specify the id to the input and image preview by `data-input` and `data-preview`.
```html
<div class="input-group">
<span class="input-group-btn">
<a id="lfm" data-input="thumbnail" data-preview="holder" class="btn btn-primary">
<i class="fa fa-picture-o"></i> Choose
</a>
</span>
<input id="thumbnail" class="form-control" type="text" name="filepath">
</div>
<img id="holder" style="margin-top:15px;max-height:100px;">
```
1. Import lfm.js(run `php artisan vendor:publish` if you need).
```javascript
<script src="/vendor/laravel-filemanager/js/lfm.js"></script>
```
1. Init filemanager with type. (requires jQuery)
```javascript
$('#lfm').filemanager('image');
```
or
```javascript
$('#lfm').filemanager('file');
```