php - How to resize, optimize multiple pictures in laravel job before saving and without using third party service?

Is there a way to optimized and resized upload pictures in Laravel before even saving the picture to server-side and without using third party service if you deal with multiple image upload?. I was passing request object to the dispatch method:

    ProcessUploadedImage::dispatch($request);

According to Laravel documentation, it is not allowed to pass serialized object to Laravel job.

Answer

Solution:

Aftet user sent you a request with an image in it, its saved locally in a tmp directory. so it saved anyway.

I suggest you to use spatie medialibrary for your project to manipulate images in jobs such as resize or opimize or even convert

Source