Optimizing / compressing image uploads before saving to disk (no media library)
Hi all
I’ve got several optimisations I want to apply to images uploaded via the upload field before they’re saved to storage.
I don’t need help with the optimisations themselves. What I need to figure out is how to apply things to the uploaded file before it’s saved from Livewire’s temporary storage to my S3 disk.
Any ideas? I’m not using any media library plugins so I need to work with the files directly.
I’ve got several optimisations I want to apply to images uploaded via the upload field before they’re saved to storage.
I don’t need help with the optimisations themselves. What I need to figure out is how to apply things to the uploaded file before it’s saved from Livewire’s temporary storage to my S3 disk.
Any ideas? I’m not using any media library plugins so I need to work with the files directly.
Solution
I think its all starting here
https://github.com/joshembling/image-optimizer/blob/4d4ba6a63931533a4b8a2b6291fbd8753e741d69/src/Components/BaseFileUpload.php#L189C16-L189C37
in
btw the plugin dose works with native file upload
https://github.com/joshembling/image-optimizer/blob/4d4ba6a63931533a4b8a2b6291fbd8753e741d69/src/Components/BaseFileUpload.php#L189C16-L189C37
in
saveUploadedFileUsing you can do whatever you needbtw the plugin dose works with native file upload
GitHub
Optimize your Filament images before they reach your database. - joshembling/image-optimizer