Path confusion with Spatie's Laravel Media Library on Laravel Forge

1.1k Views Asked by At

I am using Spatie's Laravel Media Library (v7) to create a pictures gallery. Locally (using Valet), the path to the file is OK. "/media/45/conversions/image-thumb.jpg" The equivalent path in Forge does not map - it needs to be "/storage/media/45/conversions/image-thumb.jpg" to work.

I have run php artisan storage:link and confirmed the symlink is created. This is the same (or equivalent) link in my local setup.

I know I could create a symlink to the media, but why would I need to do this on the remote server and not the local machine?

1

There are 1 best solutions below

0
On

for those who are equally foxed as I was it seems that it was the config/filesystem.php that was wrong.

namely:

 'url' => env('APP_URL').'/'.env('MEDIA_DISK')

which seemed to be fine in Valet however It should have been.

'url' => env('APP_URL').'/storage/'.env('MEDIA_DISK')

which also seems to work in Valet and now also forge