vincent15000's avatar

Help to understand the filesystems.php configuration file

Hello,

I need help to understand something in the filesystems.php configuration file.

If I have this disk configuration, are the images private ?

'images' => [
    'driver' => 'local',
    'root' => storage_path('app/private/images'),
    'url' => env('APP_URL').'/api/v1/images',
],

With Laravel, I have a controller to display private files from the above url value.

public function __invoke(Image $image)
{
    return response()->file(Storage::path('images/'.$image->name));
}

But I notice that the request doesn't pass via the controller and directly displays the image.

Can you help me understand what happens ?

Can you help me display a private image from VueJS ?

Thanks for your help.

V

0 likes
1 reply
Snapey's avatar
Snapey
Best Answer
Level 122

Your images are not private if you have run the artisan link command since this makes storage/app/public and public/storage the same content.

If you want the images only streamed by your application then put them in a private folder (not public), eg storage/app/private and make a disk for it.

1 like

Please or to participate in this conversation.