Thank you for putting together this integration, it will be very helpful to my use case once I can overcome these obstacles.
What I am trying to achieve
I'd like more control over how file names are stored in the media library, so I can reference them in the frontend. In my PageCrudController I've setup a repeatable field that uses withMedia, for the most part it works, I can successfully upload files, but my troubles start where your documentation stops -- I cannot get the certain values stored in the media table.
file_name and alt_text
I'd like the file_name column to take the original file name of what I uploaded, ideally after sanitizating it, shown here in the "sanitize the filename using a callable" example. If this cannot easily be achieved, then I'd defer to using a subfield to store a manually typed file name, so I can pass that value into the usingFileName method. Secondly, I need to associate image alt_text with each uploaded image, I plan to key in that data in another subfield named alt_text and use the customProperties method to store it.
Is there a clean way get the subfield data associated with each image into the whenSaving function?
collection_name
For my web app, I set the collection to the slug, this way I can filter the media in the frontend controller. Is there a better way to set the collection name because the slug doesn't exist until after the record is created, requiring to user to save once before uploading media?
name
This currently uses the of the repeater field's name. This makes sense for situations where there are multiple repeatables w/ images.
As you can see, the documentation got me most of the way there, it could use a strong finish! Hopefully I explained this clearly, I look forward to seeing what you suggest.
Feature Request
Thank you for putting together this integration, it will be very helpful to my use case once I can overcome these obstacles.
What I am trying to achieve
I'd like more control over how file names are stored in the media library, so I can reference them in the frontend. In my PageCrudController I've setup a repeatable field that uses withMedia, for the most part it works, I can successfully upload files, but my troubles start where your documentation stops -- I cannot get the certain values stored in the media table.
file_name and alt_text I'd like the file_name column to take the original file name of what I uploaded, ideally after sanitizating it, shown here in the "sanitize the filename using a callable" example. If this cannot easily be achieved, then I'd defer to using a subfield to store a manually typed file name, so I can pass that value into the usingFileName method. Secondly, I need to associate image alt_text with each uploaded image, I plan to key in that data in another subfield named alt_text and use the customProperties method to store it.
Is there a clean way get the subfield data associated with each image into the whenSaving function?
collection_name For my web app, I set the collection to the slug, this way I can filter the media in the frontend controller. Is there a better way to set the collection name because the slug doesn't exist until after the record is created, requiring to user to save once before uploading media?
name This currently uses the of the repeater field's name. This makes sense for situations where there are multiple repeatables w/ images.
How I see it implemented
As you can see, the documentation got me most of the way there, it could use a strong finish! Hopefully I explained this clearly, I look forward to seeing what you suggest.