PHP code example of golchha21 / resmushit
1. Go to this page and download the library: Download golchha21/resmushit 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/ */
golchha21 / resmushit example snippets
// config/ReSmushIt.php
return [
'original' => true|false,
'quality' => 92,
'mime' => [
'image/png',
'image/jpeg',
'image/gif',
'image/bmp',
'image/tiff',
],
'useragent' => 'SOME USER AGENT',
'exif' => true|false,
];
bash
php artisan vendor:publish --provider Golchha21\ReSmushIt\Providers\ServiceProvider --tag=config
php
$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);
php
$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);