reSmush.it is a FREE API that provides image optimization. reSmush.it has been implemented on the most common CMS.

Moreover, reSmush.it is the most used image optimization API with more than 7 billions images already treated, and is still totally Free of charge !

Ever since I came to know about it I have been using the service for my WordPress setups.

When I started working with Laravel I was missing this service. So here is the package that I published and now am using in all my Laravel Projects.

Here is how you can use the package:

Install via Composer

composer require golchha21/resmushit

Publish configuration file

php artisan vendor:publish --provider Golchha21\ReSmushIt\Providers\ServiceProvider --tag=config

Once you publish the configuration file you can change the values as per you usage:

return ['original' => true|false,'quality' => 92,'mime' => [
'image/png',
'image/jpeg',
'image/gif',
'image/bmp',
'image/tiff',
],
'useragent' => 'SOME USER AGENT','exif' => true|false,];

Finally, you can use it in two ways:

    $file = public_path('images/news1.jpg');
$files = [
public_path('images/news1.jpg'),
public_path('images/news2.jpg'),
public_path('images/news3.jpg'),
public_path('images/news4.jpg'),
];
$resmushit = new ReSmushIt();
$result = $resmushit->path($file);
$results = $resmushit->paths($files);

2.

    $file = public_path('images/news1.jpg');
$files = [
public_path('images/news1.jpg'),
public_path('images/news2.jpg'),
public_path('images/news3.jpg'),
public_path('images/news4.jpg'),
];
Optimize::path($file);
Optimize::paths($files);

Voila.

Do try and let me know. Also if you find any error and or bugs do add an issue here.

Few links:

A multidisciplinary freelancer specialized in identity design, website development & also a Social Media Enthusiast.