Spatie Image Optimizer Health Check

January 29, 2023
Sometimes you figure out why the uploaded image is not progressive, while you use a media-library to handle the upload. This check will help you figure out if tools are installed on your server.

When using laravel-medialibrary, it uses an image-optimizer under the hood, and this probably would not work if optimizer tools are not installed on your server. These checks are where you can check if an optimizer is installed on your server.

You can install the package via composer.


composer require lloricode/spatie-image-optimizer-health-check


And now you can add this check to your check list.


use Lloricode\SpatieImageOptimizerHealthCheck\ImageOptimizerCheck;
use Spatie\Health\Facades\Health;

Health::checks([
    ImageOptimizerCheck::new(),
]);

Also, you can set up what you want to check.


Health::checks([
    ImageOptimizerCheck::new()
        ->checkJPEGOPTIM()
        ->checkOPTIPNG()
        ->checkPNGQUANT()
        ->checkSVGO()
        ->checkGIFSICLE()
        ->checkWEBP(),
]);

And that's it, you can also see this check on the spatie health check page.