image upload using URL
Has anyone managed to create a way to upload media via URL to the https://filamentphp.com/plugins/filament-spatie-media-library plugin?
What I've managed to do so far is this:
However, nothing appears on the form and when I try to save it, an empty error occurs.
Filament
Spatie Media Library by Filament - Filament
Filament support for Spatie's Laravel Media Library package.
8 Replies
I get a lot of imports, but don't have a field for the URL, but maybe it helps you to use this:
$model would be your Model that has media attached and the $collection is the collection name.
that worked great!
Now I need reload the SpatieMediaLibraryFileUpload because I need refresh the page to see the image.
Do you know how do this?
how did you display the image in the table
Not yet, I am going to work on this again in a few weeks. My current plan: Use Laravel Reverb to send an event to my Filament table (see Spatie Media Library Events https://spatie.be/docs/laravel-medialibrary/v11/advanced-usage/consuming-events) to trigger and update.
Introduction | laravel-medialibrary
laravel-medialibrary
There is a column for that, see https://fxtwitter.com/neverything/status/1805164009404211306
💬 1 🔁 3 ❤️ 25 👁️ 1.8K
FxTwitter / FixupX
Silvan Hagen ⚡️ (@neverything)
Filament tip: Don't forget to add the conversion with a small preview unless you really need to load the original image 😅 when using the Spatie Media Library plugin.
Before you ask, yes, I was wondering why the images are taking ages to load 🤦♂️
What if i have a case where in mine db i first use custom logic for storing images and now i have to use spatie, but on the production i still have the images that are made with custom logic
You could write a custom artisan command to import the images into the Spatie Media Library, that's probably what I would do.
thanks
i will do it