Fill FileUpload with generated images
Im trying to fill a FileUpload field with an image I generate using OpenAI's Dall e
I added the required FileUpload field to my schema and I added the action to generate the image. This action uses a form to ask the user for a prompt:
I already prepared the controller for generating the image and downloading it into storage:
I already tried to set the ai_image field using the Set method, but this didn't work. Is this possible in Filament? The ultimate goal is to generate the image and show it in the FileUpload preview, so the user can see it before saving.
Solution:Jump to solution
I had a similar use case, here is how i did it https://github.com/mansoorkhan96/filament-unsplash-picker/blob/df4d6c3bd3fe720ec11e3cfe6686bd97a812d892/src/Actions/UnsplashPickerAction.php#L104
Maybe not the best way to do it, but it works good....
GitHub
filament-unsplash-picker/src/Actions/UnsplashPickerAction.php at df...
Unsplash gallery for Filament. Search and pick any image from Unsplash.com - mansoorkhan96/filament-unsplash-picker
2 Replies
Solution
I had a similar use case, here is how i did it https://github.com/mansoorkhan96/filament-unsplash-picker/blob/df4d6c3bd3fe720ec11e3cfe6686bd97a812d892/src/Actions/UnsplashPickerAction.php#L104
Maybe not the best way to do it, but it works good.
GitHub
filament-unsplash-picker/src/Actions/UnsplashPickerAction.php at df...
Unsplash gallery for Filament. Search and pick any image from Unsplash.com - mansoorkhan96/filament-unsplash-picker
Thank you!