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
you should probably do it in a model observer that queues a job
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
Consuming events | laravel-medialibrary
laravel-medialibrary