Linked Questions

Popular Questions

Voyager for Laravel 5: Wrong paths for images

Asked by At

Having created a new user via Voyager, the avatar was showing as a broken image. I uploaded a new image, but the image remained broken.

I checked with Console in Google Chrome and found 3 404 errors:

2017-06-19 10:53:50.159 http://localhost:8888/storage/users/June2017/ypKlbqbATDbpnYctZBFp.png Failed to load resource: the server responded with a status of 404 (Not Found)

2017-06-19 10:53:50.256 http://localhost:8888/storage/users/June2017/ypKlbqbATDbpnYctZBFp.png Failed to load resource: the server responded with a status of 404 (Not Found)

2017-06-19 10:53:50.473 http://localhost:8888/vendor/tcg/voyager/assets/images/bg.jpg Failed to load resource: the server responded with a status of 404 (Not Found) When I looked at the project, the paths for the 2 storage errors are: http://localhost:8888/storage/app/public/users/ and: http://localhost:8888/storage/app/public/users/June2017

While in Media, I'm seeing similar path problems when navigating the folders:

2017-06-19 11:38:22.248 %7B%7B%20selected_file.path%20%7D%7D:1 GET http://localhost:8888/development/PhpstormProjects/Search4Venues/public/admin/%7B%7B%20selected_file.path%20%7D%7D 404 (Not Found)

Anticipating the question, in .env, I have: APP_URL=http://localhost:8888

Is this a configuration error?

EDIT

A colleague with more experience than me has been through Voyager and found some inconsistencies, which he's attempted to fix.

In app.php, we've had to change:

'url' => env('APP_URL', 'http://localhost:8888/development/PhpstormProjects/Search4Venues'),

... to:

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

In filesystems.php, we've had to change:

'public' => [
    'driver' => 'local',
    'root' => storage_path('app/public'),
    'url' => env('APP_URL').'/storage',
    'visibility' => 'public',
]

... to:

'public' => [
    'driver' => 'local',
    'root' => storage_path('app/public'),
    'url' => env('APP_URL').'/development/PhpstormProjects/Search4Venues/public/storage',
    'visibility' => 'public',
]

However, he discovered other problems in config/voyager.php:

'assets_path' => '/vendor/tcg/voyager/assets',

... where it too appears to be missing PhpstormProjects/Search4Venues from the path:

http://localhost:8888/vendor/tcg/voyager/assets/images/bg.jpg

At this stage, we have no idea what else could be wrong with Voyager.

Related Questions