I had difficulty saving the path to my project. My project integrates laravel-manager.
Select image from laravel-manager
When I confirmed the selection of the image in laravel-manager, no path appeared in the input field.
Confirm Additional Images
For additional context, my project does not yet handle user permissions or logins, so I call laravel-manager in web.php as follows:
Route::group(['prefix' => 'laravel-filemanager', 'middleware' => []], function () {
UniSharpLaravelFilemanagerLfm::routes();
});
In config/filesystems, I have configured it as follows:
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
// 'url' => env('APP_URL').'/storage',
'url' => '/storage',
'visibility' => 'public',
'throw' => false,
],
Because when I set the url to env(‘APP_URL’).’/storage’, the image paths were incorrect and I could not see them in laravel-manager.
In the file section(create.blade) I use the following:
<div class="form-group">
<label for="thumbnail" class="form-label">Image<span class="text-danger">*</span></label>
<div class="input-group">
<div class="input-group-prepend">
<button type="button" id="lfm" data-input="thumbnail" data-preview="holder" class="btn btn-alt-primary">Choose</button>
</div>
<input type="text" class="form-control" id="thumbnail" name="ration_image" required>
@error('ration_image')
<p class="text-danger">{{ $message }}</p>
@enderror
</div>
<img id="holder" style="margin-top:15px;max-height:100px;" src="{{ old('ration_image') }}" alt="Selected Image">
</div>
…..
And use the following script:
<script src="/vendor/laravel-filemanager/js/stand-alone-button.js"></script>
<script src="{{ asset('/js/plugins/jquery-ui-1.13.2/jquery-ui.min.js') }}"></script>
<script>
var route_prefix = "/laravel-filemanager?editor=file";
$('#lfm').filemanager('image', {
prefix: route_prefix,
onSuccess: function(data) {
$('#thumbnail').val(data.url);
}
});
</script>
I’m not sure if it doesn’t work because I haven’t implemented user authentication yet. I’m hoping we can find an answer.
I tried and added in config/lfm.php, I added the following:
dir' => 'public/uploads/images',
'url_prefix' =>' storage/uploads/images',
and edited’should_create_thumbnails’ => false,
2
Answers
upload and images spelling in wrong at
dir’ => ‘public/uploads/images’,
‘url_prefix’ =>’ storage/uplaads/immages’,
The
prefix
you use in your filemanager initialization command includes theeditor
parameter, so the filemanager thinks you’re using it with a Wysiwyg Editor rather than a standalone button.Remove the word
editor
from theprefix
.For more details, you can ref in here