Can't preview an image with 'private' disk when using spatie-laravel-media-library-plugin

Hi, I have field like this
SpatieMediaLibraryFileUpload::make('business_license')
->collection('business-license')
->disk('private')
->image()
->visibility('private')
->label(__('Business License'))
->maxSize(1024),
SpatieMediaLibraryFileUpload::make('business_license')
->collection('business-license')
->disk('private')
->image()
->visibility('private')
->label(__('Business License'))
->maxSize(1024),
, Uploading works fine. But I can't preview this image when I view/edit the reocrd. here is the disk in my 'config/filesystems.php':
'private' => [ //For private files
'driver' => 'local',
'root' => storage_path('app/private'), // Important: Different directory!
'url' => env('APP_URL').'/private', // It is important to set url, otherwise, error may occur.
'visibility' => 'private',
],
'private' => [ //For private files
'driver' => 'local',
'root' => storage_path('app/private'), // Important: Different directory!
'url' => env('APP_URL').'/private', // It is important to set url, otherwise, error may occur.
'visibility' => 'private',
],
. On the model, I do have this block
$this
->addMediaCollection('business-license') // Collection for the business license
->useDisk('private')
->acceptsMimeTypes(['image/jpeg', 'image/png', 'image/jpg'])
->singleFile(); // Enforce that only one file can be in this collection
$this
->addMediaCollection('business-license') // Collection for the business license
->useDisk('private')
->acceptsMimeTypes(['image/jpeg', 'image/png', 'image/jpg'])
->singleFile(); // Enforce that only one file can be in this collection
. I checked the document "One way to store files privately is to configure this in your S3 bucket settings, in which case you should also use visibility('private') to ensure that Filament generates temporary URLs for your files.", but I just use a local 'private' disk. any insights on how to let 'Filament generates temporary URLs ' for my loal private files? thanks
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?