F
Filament2mo ago
morty

Spatie Media Library Plugin black screen on upload of some files

I have no idea what's happening. There is no log, no exceptions, no errors. When uploading only some images, the upload succeeds but then gives a black modal screen. Example image: https://imgur.com/a/kjG7ksS Below is a GIF of the issue. This is my code:
SpatieMediaLibraryFileUpload::make('photos')
->collection('photos')
->disk(Filament::getId())
->visibility('private')
->multiple()
->reorderable()
->panelLayout('grid')
->openable()
->maxSize(1024 * 10) // 10MB
->image(),
SpatieMediaLibraryFileUpload::make('photos')
->collection('photos')
->disk(Filament::getId())
->visibility('private')
->multiple()
->reorderable()
->panelLayout('grid')
->openable()
->maxSize(1024 * 10) // 10MB
->image(),
No description
Solution:
Thanks for testing. I noticed it was doing an error 500 in the console so I searched around and found this thread: https://github.com/spatie/laravel-medialibrary/issues/322 I upped my memory limit from 128 to 256 and it seems to have resolved the issue. Unsure why so much memory is necessary though....
GitHub
HTTP 500 error when uploading (large) file · Issue #322 · spatie/la...
Hi, I'm trying to use a media conversion to resize the uploaded images. When I upload small files (around 300kB), everything works. The images are stored correctly and a conversion shows up in ...
Jump to solution
5 Replies
morty
mortyOP2mo ago
I have many other images that don't do this. I'm wondering if someone using this plugin can maybe give that image a try and see if they have the same issue?
ChesterS
ChesterS2mo ago
Welp, for what it's worth, I downloaded the image and it works fine. That black screen is what happens when something breaks along the way so there should be logs somewhere (either console or server logs) Assuming it that works with other files, check file limits etc
Solution
morty
morty2mo ago
Thanks for testing. I noticed it was doing an error 500 in the console so I searched around and found this thread: https://github.com/spatie/laravel-medialibrary/issues/322 I upped my memory limit from 128 to 256 and it seems to have resolved the issue. Unsure why so much memory is necessary though.
GitHub
HTTP 500 error when uploading (large) file · Issue #322 · spatie/la...
Hi, I'm trying to use a media conversion to resize the uploaded images. When I upload small files (around 300kB), everything works. The images are stored correctly and a conversion shows up in ...
sweetplum
sweetplum4w ago
Hi, I saw the ->visibility('private') in your code, on the edit page are you able to preview this image? I have something like this
SpatieMediaLibraryFileUpload::make('business_license')
->collection('business-license')
->disk('private')
->image()
->visibility('private') // This is important, but doesn't solve the preview issue on its own
->label(__('Business License'))
->maxSize(1024),
SpatieMediaLibraryFileUpload::make('business_license')
->collection('business-license')
->disk('private')
->image()
->visibility('private') // This is important, but doesn't solve the preview issue on its own
->label(__('Business License'))
->maxSize(1024),
, Uploading is fine. but when I view/edit the reocrd, I can't preview this image. 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',
],
. any idea why preview is not working? thanks.
morty
mortyOP4w ago
Sorry, just seeing this now. How are you previewing the files, are you using the form component or an infolist component?

Did you find this page helpful?