Laravel-filemanager: view file url

Created on 29 Apr 2017  路  23Comments  路  Source: UniSharp/laravel-filemanager

hello ! i use version 1.7.6 .
my folder is

  1. laravel-project
  2. public_html
    my setting --------------------------------------
'base_directory' => '../public_html',

'images_folder_name' => 'photos',
'files_folder_name'  => 'files',

'shared_folder_name' => 'shares',
'thumb_folder_name'  => 'thumbs',

and this is my error :
image

my question is how to remove laravel-filemanager/ from image url ?

question

All 23 comments

Edit prefix config in config/lfm.php.

I dont think this is a correct answer
The prefix of the URLs is hardcoded in LfmHelpers.php
Look at my commit to avoid this behaviour; Prefix of URLs

Thank you @atzeteppema . You pull request was accepted. However, it is better to use the prefix config instead. See another pull request #294 .

But i want to use different paths (prefixes) for the filemanager itself and the images/files displayed on my site. How do you think about that option?

I suspect the problem here is that you are using a 'base_directory' other than 'public', but have not set up the appropriate routes to do so. This will cause your images to be broken, and the URL to contain the package name.

I'm with the same problem.
Files are uploaded to the right folder: "/site/uploads/i/s/..."
But the links inside file manager are wrong: "site/laravel-filemanager/i/s/..."
When i click to insert to editor/button it only works if i change the links from "laravel-filemanager" to "uploads" on developer toolbar.

'prefix' => 'site/uploads',
'urls_prefix' => '',
'base_directory' => '../public_html/site/uploads',
'images_folder_name' => 'i',
'files_folder_name'  => 'f',
'shared_folder_name' => 's',
'thumb_folder_name'  => 'thumbs',

How to fix? Thanks.

@rodrigopeixotobr
You can follow Prefix of URLs

'prefix' => 'laravel-filemanager',    // url site/laravel-filemanager/i/s/
'urls_prefix' => 'site/uploads',    // folder upload
'base_directory' => '../public_html/site/uploads',  //root web server is "public_html"
'images_folder_name' => 'i',
'files_folder_name'  => 'f',
'shared_folder_name' => 's',
'thumb_folder_name'  => 'thumbs',

Hi,
My current image url is http://mywebsite.com/laravel-filemanager/photos/4/xxx.jpg
I want it to be http://mywebsite.com/photos/4/xxx.jpg

I set the prefix in lfm.php as suggested , below is my config
'prefix' => '',

But i got a new problem, clicking 'Browse Server' button in the CKEditor Image property pop up will give me ' NotFoundHttpException ' error page, the browse page cannot be opened.

Please help

The prefix setting cannot be empty. It sets up the route to filemanager itself.

hmm ok, so how should be my config look like if i want to have url like this
http://mywebsite.com/photos/4/xxx.jpg

Thanks

@dennysutanto you should set base_directory to public.

hi @g0110280
But I have my laravel app at the same folder level as my public_html

my current base_directory is
'base_directory' => '../public_html/mywebsite'

@dennysutanto Doesn't support that for now. Are you using XAMPP?

@g0110280 No, i use Mac with standalone PHP, apache and mysql.
The problem is in my shared hosting.
Base on some reading from internet, it's recommended to put the laravel app not in public_html
so this is my current folder structure in my shared hosting

/home/denny/mylaravelapp/app
/home/denny/mylaravelapp/bootstrap
/home/denny/mylaravelapp/config
/home/denny/mylaravelapp/resources
and so on.. ( all the laravel files )

And this is my public folder
/home/denny/public_html/index.php
/home/denny/public_html/js/xxx
/home/denny/public_html/css/xxx
/home/denny/public_html/images/xxx
/home/denny/public_html/favicon.ico

Thanks

@dennysutanto Maybe you should move files from /home/denny/public_html/ to /home/denny/mylaravelapp/public/.

@g0110280 I don't think i can do that , /home/denny/public_html is the web root, accessible by public, if i move to /home/denny/mylaravelapp/public/ , i don't think it's accessible by public.

I think for now i will just change the url to http://mywebsite.com/extrafolder/photos/4/xxx.jpg
and i will set my 'prefix' => 'extrafolder',

I believe this will work

Thanks @g0110280

Hey guys i think i am having the same problem here
images gets saved in my public folder but in my display image page the image link is broken the
image links are domain-name.com/beta/public/index.php/photos/xxx.jpg
but if i remove index.php and try with domain-name.com/beta/public/photos/xxx.jpg then image appears so where should i make changes in the code ?

the configs are
'prefix' => 'laravel-filemanager',

'base_directory' => 'public' ,
'images_folder_name' => 'photos',
'files_folder_name' => 'files',
'shared_folder_name' => 'shares',
'thumb_folder_name' => 'thumbs',

i am having the same problem. when deploying shared hosting and seting public_html folder then adding default prefix.
'base_directory' => '/../public_html',
site.com/laravel-filemanager/photos/1/2-5.jpg

in config/lfm.php
'user_field' => Unisharp\Laravelfilemanager\Handlers\ConfigHandler::class,
to
'user_field' =>'',

Closing inactive issue.

i faced the same problem and I solved it as following
go to config*lfm.php*
and put this lines :
'base_directory' => 'public',

'images_folder_name' => 'files',
'files_folder_name'  => 'files',

'shared_folder_name' => 'shares',
'thumb_folder_name'  => 'thumbs',

Hello, Let me know, now image file save this format http://localhost:8004/storage/files/shares/Group66.png and want to change /storage/files/shares/Group66.png and how to remove app url in db

@zinnia-visible for a simple solution for this,
copy unisharp/laravel-filemanager/public/ to the project's vendor directory._This will help to protect from composer update._
Change the setUrl function from "laravel-filemanager/js/stand-alone-button.js" as below:
..
..

 window.SetUrl = function (items) {
                var file_path = items.map(function (item) {
                    return "/storage/" + item.url.split("storage/")[1];
                }).join(','); 

..
..

Was this page helpful?
0 / 5 - 0 ratings

Related issues

farshidrezaei picture farshidrezaei  路  4Comments

DaxtonChen picture DaxtonChen  路  4Comments

phamtien9819 picture phamtien9819  路  5Comments

lunadiotic picture lunadiotic  路  3Comments

t67132 picture t67132  路  3Comments