PHP code example of dmknvk / laravel-image-optimizer
1. Go to this page and download the library: Download dmknvk/laravel-image-optimizer library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
'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)
],
],