Images optimization for Google PageSpeed Insights
dmknvk/laravel-image-optimizer is a Laravel package for images optimization for google pagespeed insights.
It currently has 11 GitHub stars and 1.221 downloads on Packagist (latest version v0.1.2).
Install it with composer require dmknvk/laravel-image-optimizer.
Discover more Laravel packages by dmknvk
or browse all Laravel packages to compare alternatives.
Last updated
This is a package for Laravel 5 that optimize images for Google PageSpeed Insights requirements.
This package uses the following tools in your system:
Require this package with composer:
composer require dmknvk/laravel-image-optimizer
After updating composer, add the ServiceProvider to the providers array in config/app.php
DmKnvk\LaravelImageOptimizer\ServiceProvider::class,
Copy the package config to your local config with the publish command:
php artisan vendor:publish --provider="DmKnvk\LaravelImageOptimizer\ServiceProvider"
Set your directories pathes that will be optimized in config/image-optimizer.php
'dirs' => [
public_path('media'), // all png/jpeg images in folder public/media will be optimized recursively
public_path('upload') => [
'types' => ['images/png'], // array of mime types, that will be optimized (now supported image/png and image/jpeg)
'recursive' => false, // search images only in root directory (public/upload)
],
],
Run artisan command (or add to cron) with root priveleges (to avoid problems with permissions)
sudo php artisan image-optimizer:run
All files in your directories will be optimized with max optimization levels (takes some time).