PHP code example of davgothic / smushit
1. Go to this page and download the library: Download davgothic/smushit 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/ */
davgothic / smushit example snippets
use DavGothic\SmushIt\Client;
use DavGothic\SmushIt\SmushIt;
;
// Compress a local/remote image and return the result object.
$result = $smushit->compress('some/path/to/an/image.png');
print_r($result);
// stdClass Object
// (
// [src] => http://static0.resmush.it/output/1262dc777d8b239cfdf5f528a4032f02/source.png
// [dest] => http://static1.resmush.it/output/a9ba82e7ba18e9482e085fadb126edad/output.png
// [src_size] => 455200
// [dest_size] => 158075
// [percent] => 65
// [format] => png
// [expires] => Sun, 19 Mar 2017 18:00:33 +0100
// [generator] => reSmush.it rev.1.4.22.20170224
// )