Skip to content

Commit a1b516a

Browse files
committed
added independent filemanager usage capability
1 parent e0aba51 commit a1b516a

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,40 @@ PR is welcome!
135135
</script>
136136
```
137137
138+
### Option 3: Independent use
139+
140+
If you are going to use filemanager independently,meaning set the value of an input to selected photo/file url,follow this structure:
141+
142+
1. create a popup window or modal(whatever you like):
143+
144+
```html
145+
<a href="/laravel-filemanager" id="feature-img-container"><img src="no_photo.jpg"></a>
146+
```
147+
148+
```javascript
149+
$('#feature-img-container').on('click', function(e)
150+
{
151+
152+
window.open(this.href, 'Filemanager', 'width=900,height=600');
153+
154+
return false;
155+
});
156+
```
157+
158+
2. define a function named `SetUrl` :
159+
160+
```javascript
161+
function SetUrl(url){
162+
163+
//set the value of the desired input to image url,often this is a hidden input
164+
$('#thumbnail').val(url);
165+
166+
//set or change the feature image src,recall wordpress feature image
167+
$('#feature-img-container').find('img').attr('src',url);
168+
}
169+
```
170+
171+
138172
## Config
139173

140174
In `config/lfm.php` :

src/views/index.blade.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,9 +487,8 @@ function getUrlParam(paramName) {
487487
parent.CKEDITOR.tools.callFunction(getUrlParam('CKEditorCleanUpFuncNum'));
488488
}
489489
} else {
490-
491490
// use FCKEditor 2.0 integration method
492-
if (data['Properties']['Width'] != '') {
491+
if (typeof data != 'undefined' && data['Properties']['Width'] != '') {
493492
var p = url;
494493
var w = data['Properties']['Width'];
495494
var h = data['Properties']['Height'];
@@ -508,6 +507,7 @@ function getUrlParam(paramName) {
508507
509508
window.close();
510509
}
510+
//end useFile
511511
512512
function notImp() {
513513
bootbox.alert('Not yet implemented!');;
@@ -534,6 +534,7 @@ function makeRandom() {
534534
}
535535
return text;
536536
}
537+
537538
</script>
538539
</body>
539540
</html>

0 commit comments

Comments
 (0)