How to also save a thumbnail when uploading a file?

Right now I am uploading files via FileUpload() but I would also like to create thumbnails as well alongside. I don't need to see thumbnails in filament admin or set ups extra stuff. Ideally I would like to add some suffix like "-thumbnail" to the file that is identically named but just smaller in size e.g. 300x200 instead of 3000x2000. How to do that in Filament? Is there any hook I can say that after upload, go and resize that uploaded file using GD or something and save it as the original file - meaning with the identical name but add the suffic "-thumbnail" so I can target it easily in the frontend.
1 Reply
awcodes
awcodes8mo ago
Look up model observers in Laravel that will be the best place to do this and would also allow you to delete the images if the record is deleted.
Want results from more Discord servers?
Add your server