Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

richardhulbert's avatar

path confusion spatie media library

I am using spatie media library (v7) to create a gallery of pictures. Locally (using Valet) the path to the file is fine. "/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 set up.

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

0 likes
4 replies
Smiffy's avatar

Just to be clear, is your media directory in the root install? It should be under storage really although you could amend this in config.

richardhulbert's avatar

here is the config/filesystem.php file:

'disks' => [

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

    ],

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

    's3' => [
        'driver' => 's3',
        'key' => env('AWS_ACCESS_KEY_ID'),
        'secret' => env('AWS_SECRET_ACCESS_KEY'),
        'region' => env('AWS_DEFAULT_REGION'),
        'bucket' => env('AWS_BUCKET'),
        'url' => env('AWS_URL'),
    ],

],

];'

if that is what you are asking?

Smiffy's avatar

I don't use Valet but came across this on StackOverflow? Seems like a similar issue with fix in answers.

richardhulbert's avatar

@Smiffy Thanks yes I did come across that post. The thing is that actually it works fine in valet LOL its on forge. BUT you gave me an idea. I changed this

'media' => [
        'driver' => 'local',
        'root' => storage_path('app/public/media'),
        'url' => env('APP_URL').'/'.env('MEDIA_DISK')

    ]

to

'media' => [
        'driver' => 'local',
        'root' => storage_path('app/public/media'),
        'url' => env('APP_URL').'/strorage/'.env('MEDIA_DISK')

    ]

and that still works in Laravel and I assume that will be ok with Forge as that is the path it needs. Thanks for your help

Please or to participate in this conversation.