2017 © Pedro Peláez
 

library smushit

Adds a wrapper around the Yahoo! Smushit service.

image

neo/smushit

Adds a wrapper around the Yahoo! Smushit service.

  • Saturday, December 21, 2013
  • by CreativityKills
  • Repository
  • 0 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Smush.it API Library

Build Status, (*1)

This is a library that makes it easy to use the Smush.it API on your projects. Usage is easy, first install the library by unzipping to your library directory or better still using composer:, (*2)

Requirements

  • JSON extension
  • cURL extension

Installation

Using Composer

Add this to your composer file:, (*3)

"require" : {
    "neo/smushit" : "dev-master"
}

Then you can now run your composer install command and let it install all the dependencies., (*4)

Usage

To smush an image you should do this:, (*5)

$original_image = 'http://placehold.it/300x300';

try
{
    $response = Neo\Smushit\Smushit::make($original_image);

    $resized = $response->dest;
}
catch(Neo\Smushit\Exception\SmushitException $e)
{
    $resized = $original_image;
}

Here is a sample response that can help you decode exactly how to handle various responses:, (*6)

Successful response

{
    "src":"http://placehold.it/300x300",
    "src_size":1200,
    "dest":"http://ysmushit.zenfs.com/results/c1c4ef27%2Fsmush%2F300x300.png",
    "dest_size":921,
    "percent":"23.25",
    "id":""
}

Unsuccessful response

{
    "src":"http://placehold.it",
    "error":"Could not get the image",
    "id":""
}

The Versions

21/12 2013

dev-master

9999999-dev

Adds a wrapper around the Yahoo! Smushit service.

  Sources   Download

MIT

The Requires

 

by neo

image compression creativitykills smushit neo

21/12 2013

dev-dev

dev-dev

Adds a wrapper around the Yahoo! Smushit service.

  Sources   Download

MIT

The Requires

 

by neo

image compression creativitykills smushit neo