- You can safely use it nowadays. The support is pretty good: https://caniuse.com/webp So its mostly up to you if you want to :) Just make sure the spatie optimizer works with webp
- I cannot think of a way to test it without setting up a more "advanced" dev environment. If you really want to test it you can use wsl2 to install ubuntu and run it on there (or use docker)
Images Optimization With Laravel
I'm building a platform where people can upload product images, I have used Laravel Image Optimizer's middleware to automatically optimize any image uploaded in specific routes.
// automatically optimize images
Route::middleware('optimizeImages')->group(function () {
Route::post('products/create', [ProductController::class, 'store'])->name('products.create');
Route::post('webshops/create', [WebshopController::class, 'store'])->name('webshops.create');
});
Now according to the docs for the package, Since I added their middleware in the Karnel 's $routeMiddleware it should optimize automatically any image uploaded in those routes.
My questions are:
1- I found Laravel-webp which converts all images to Webp and I think Webp is the perfect option for any web app since it's really small sized files. Should I use this package to convert all images to webp and then use laravel image optimizer's middleware to optimize the images?
2- Since laravel image optimizer package doesn't work unless I install image optimization tools, how can I test it on windows local server? how would I know it works?
3- If it's still a small project, is it okay to store images in database? Or should it be S3 free plan?
Please or to participate in this conversation.