F
Filament2y ago
Wint

How to optimize a uploading image

I'm trying to optimize the image while uploading using spatie/image-optimizer but don't how to do this, can you help me out. - I see we can add manipulations when uploading images but couldn't figure out what string should be passed into. - Or should I using a middleware? how should I using a middleware with file upload? Or which function should I use to hook into the upload process?
2 Replies
Dan Harrin
Dan Harrin2y ago
you should probably do it in a model observer that queues a job
Wint
WintOP2y ago
Thanks for your idea, I ended up using a event listener as mentioned here: https://spatie.be/docs/laravel-medialibrary/v10/advanced-usage/consuming-events
Want results from more Discord servers?
Add your server