https://github.com/davgothic/smushit
SmushIt is a PHP client for the popular Yahoo! image compression web service Smush.it
https://github.com/davgothic/smushit
image-optimization php smushit
Last synced: 10 months ago
JSON representation
SmushIt is a PHP client for the popular Yahoo! image compression web service Smush.it
- Host: GitHub
- URL: https://github.com/davgothic/smushit
- Owner: davgothic
- License: mit
- Created: 2011-01-15T00:08:23.000Z (about 15 years ago)
- Default Branch: master
- Last Pushed: 2018-08-05T16:19:34.000Z (over 7 years ago)
- Last Synced: 2025-04-08T13:47:47.313Z (10 months ago)
- Topics: image-optimization, php, smushit
- Language: PHP
- Homepage:
- Size: 30.3 KB
- Stars: 36
- Watchers: 3
- Forks: 14
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
SmushIt
==========
[](https://packagist.org/packages/davgothic/smushit)
[](https://travis-ci.org/davgothic/smushit)
[](https://packagist.org/packages/davgothic/smushit)
[](https://github.com/davgothic/smushit/blob/master/LICENSE.md)
SmushIt is a PHP client for the popular Yahoo! image compression web service [Smush.it](http://www.smushit.com/ysmush.it/)
Basic Usage
-----------
```php
use DavGothic\SmushIt\Client;
use DavGothic\SmushIt\SmushIt;
include __DIR__ . '/vendor/autoload.php';
$client = new Client\Curl();
$smushit = new SmushIt($client);
// 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
// )
```
Installation
------------
To install the most recent version via [composer](https://getcomposer.org/), run the following command:
```sh
composer require davgothic/smushit
```
Requirements
------------
- PHP 5.5.0+
- PHP JSON extension
- PHP cURL extension (This requirement can be ignored if using any client other than the provided cURL client)