简体   繁体   中英

Laravel Voyager not showing images

I have created a Laravel app using installatron on godaddy.com (shared hosting). After installing Voyager the default admin avatar is not showing. The storage link is automatically created by Voyager. But when I open the admin panel voyager tries to get admin avatar from [app_url]/storage/users/default.png and receives a 404. The avatar is at [app_url]/public/storage/users/default.png

Screenshot

Versions: Laravel: 5.8 Voyager: 1.3

如果使用 localhost,请将端口号放入 .env 文件中

APP_URL=http://localhost:port_number

I've faced the exact same issue before, after checking the APP_URL, go ahead and execute

php artisan config:clear

After that try again.

If it doesn't work, delete the symlink storage in public/ and execute

php artisan storage:link

Please check if the APP_URL in your .env file is correct.

That it equals the domain-name you bought at godaddy and also the protocol (HTTP or HTTPS).

Simply change the 'APP_URL' variable into the .env file to your localhost route.

For example:

APP_URL=http://127.0.0.1:8000

I was facing this issue today

in my case 3 steps:

1- correct App_URL in .env file (do`nt forget port number ) example:

APP_URL=http://127.0.0.1:8000

2- delete storage file from [project path]\public

3- run: php artisan storage:link

enjoy:)

I solved my problem in local try with adding port to APP_URL . But in the server problem was the "Storage" folder which is in public directory.

UPDATE Feb 2022 please notice the symbolic link must be existed in your root

在您的 .env 文件中,替换应用 URL。

APP_URL=http://localhost:port 

I had to change the setting in filesystems.php .

'url' => env('APP_URL').'/nameOfMyRootFolder/storage/app/public',

Then it was able to resolve the image link correctly.

更改 filesystems.php 中的设置,disks -> public -> "url => env('APP_URL').'/public/storage'"

请检查 .env 文件中的 APP_URL=<> 它应该基本上像

APP_URL=http://localhost:8000

Check APP_URL in .env file, make sure that APP_URL in .env file is to the public folder of your project

APP_URL=http://localhost/your-project-name/public/

APP_URL setting worked for me. I'm running the app in a container so I have to put the port used from my host not 8000. I have port 8000 mapped to 8186, so I have to put APP_URL=http://localhost:8186

如果您使用的是sails,请尝试运行:

 sail artisan storage:link

work for me:

image see in url http://localhost:8000/storage/users/default.png but dont in /admin panel (http://localhost/storage/users/default.png 404) its a port problem with storage

change in config/app to

'url' => env('APP_URL', 'http://localhost:8000')

If you're still wonder why, check this answer in voyager issues

Since FILESYSTEM_DRIVER was not defined by default in Laravel the public storage was used, but in Laravel 8.5.19 the default value was added.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM