## Note Check `vendor/unisharp/laravel-filemanager/src/views/demo.blade.php`, which already integrated all options from below. ## WYSIWYG Editor Integration: ### Option 1: CKEditor ```html ``` * Sample 1 - Replace by ID: ```html ``` * Sample 2 - With JQuery Selector: ```html ``` ### Option 2: TinyMCE4 ```html ``` ## Standalone button 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
Choose
``` 1. Import lfm.js(run `php artisan vendor:publish` if you need). ```html ``` 1. Init filemanager with type. (requires jQuery) ```javascript $('#lfm').filemanager('image'); ``` or ```javascript $('#lfm').filemanager('file'); ``` Domain can be specified in the second parameter(optional, but will be required when developing on Windows mechines) : ```javascript var domain = "{{ url() }}"; $('#lfm').filemanager('image', {prefix: domain}); ``` ## JavaScript integration In case you are developing javascript application and you want dynamically to trigger filemanager popup, you can create function like this. It doesn't rely on jQuery. ```javascript var lfm = function(options, cb) { var route_prefix = (options && options.prefix) ? options.prefix : '/laravel-filemanager'; window.open(route_prefix + '?type=' + options.type || 'file', 'FileManager', 'width=900,height=600'); window.SetUrl = cb; } ``` And use it like this: ```javascript lfm({type: 'image', prefix: 'prefix'}, function(url, path) { }); ```