How to set meta alt+title with SpatieMediaLibraryFileUpload field?
I want to use Spatie "custom properties" and somehow enable editing these values for each uploaded photo in a gallery.
Option 1 - was thinking override the form field and extend
fileUploadFormComponent
to add canSetMeta
and somehow open a modal/side panel with 2 text inputs for both image alt and image title. Problem is I'm not sure how to override the components/file-upload.js
file.
Option 2 - might be a way to use the Repeater
field to list all uploaded photos with fields for image alt + title in a 3 column grid. Converting the data around seems like it would be clunky though.
Option 3 - could use Ralph's media library pro which enables setting meta, but I like the way the FileUpload field works better.
Any other options or ideas? Thanks for any help.13 Replies
you could use a KeyValue maybe?
and then
->customProperties(fn ($get) => $get('key_value_name'))
That would work to get the json format matching each media record for Spatie. Any idea how to get it to work with multiple photos though?
I am trying to replace this functionality from the Orchid admin (pardon the washed out screenshots). It allows clicking a button from each photo in order to open modal which then you can edit alt/title.
you would have to use #curator or #media-library-pro
If I want to try extending the field, how would I compile in a new
components/file-upload.js
? Is that documented anywhere? I see how to customize field with the class and blade part, but not sure how to combine with the Alpine JS file... https://filamentphp.com/docs/2.x/forms/fields#building-custom-fieldsgood luck trying to get filepond to open a modal, i really wouldnt bother trying to extend it
its gonna be more work than its worth
Would be similar to
insertDownloadLink
or insertOpenLink
to dispatch event for modal which then uses this Filepond metadata plugin? https://pqina.nl/filepond/docs/api/plugins/file-metadata/Easy File Uploading With JavaScript | FilePond
A JavaScript library that can upload anything you throw at it, optimizes images for faster uploads, and offers a great, accessible, silky smooth user experience.
Yeah it is more work than it's worth, that's why I haven't been able to switch to Filament yet. The ML pro plugin doesn't exactly work the way I need it to, and Curator is incompatible with Spatie ML.
Filepond is nice but quite difficult to extend
Curator is a replacement for Spatie ML, what are you missing from it?
Mainly I just wanted to use the
->responsiveImages()
part plus all the Spatie config settings. I see though that it has Curator::curationPresets
for different thumb sizes, don't remember that from the last I looked at it. Alright maybe that's the solution then thanks.curator has a "glider" blade component
it can generate responsive images on the fly
ok thanks for pointing that out, I see
oh two weeks ago Curator got support for multiple images lol. yay I think that was my previous hangup
Hi, I'm stumbling upon the same issue. I'd like admins to be able to add alt text, image credits, etc to uploaded media. Could you tell me how you ended up solving this?
Did you ever work anything out?