The official PHP Client for the Imagizer Media Engine
Switch branches/tags
Nothing to show
Clone or download
Latest commit 8d770a9 Oct 9, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Adding project files Sep 20, 2016
tests Adding project files Sep 20, 2016
vendor Adding project files Sep 20, 2016
.gitignore Adding project files Sep 20, 2016
ImagizerPhp.iml Adding project files Sep 20, 2016
README.md Added link to api doc Oct 9, 2016
composer.json Adding project files Sep 20, 2016
composer.lock Adding project files Sep 20, 2016

README.md

ImagizerPHP

The official PHP Client for the Imagizer Media Engine

The Imagizer Media Engine accelerates media delivery to your mobile Apps or Webpages by dynamically rescaling, cropping, and compressing images in real time. See all Imagizer features in our Doc.

Installation

Using Composer

Define the following requirement in your composer.json file

{
    "require": {
        "nventify/imagizer-php": "0.1.*"
    }
}

Then include the auto loading path in your application

require __DIR__ . '/vendor/autoload.php';

Basic Usage

Using the free to test Imagizer Demo Service

// Initialize the Imagizer Client
$imagizerClient = new Imagizer\Client();

// Since we are using Imagizer Engine Demo Service
// we'll need to specify our Image storage origin
// Imagizer will fetch your images from this endpoint
$imagizerClient->setOriginImageHost("example.com");

// Build a URL with resize and cropping params
// http://example.com/image.jpg?width=400&height=400&crop=fit&dpr=2&hostname=example.com
$imageUrl1 = $imagizerClient->buildUrl("image.jpg", [
    "width" => 400,
    "height" => 500,
    "crop" => "fit"
]);

// Build url with compression
// http://example.com/image.jpg?quality=55&hostname=example.com
$imageUrl2 = $imagizerClient->buildUrl("image.jpg", [
    "quality" => 55
]);

Using your own Imagizer Instance

// Initialize the Imagizer Client
$imagizerClient = new Imagizer\Client("your-imagizer-instance.example.com");

// Build a URL with resize and cropping params
// http://your-imagizer-instance.example.com/image.jpg?width=400&height=400&crop=fit&dpr=2
$imageUrl1 = $imagizerClient->buildUrl("image.jpg", [
    "width" => 400,
    "height" => 500,
    "crop" => "fit"
]);

// Build url with compression
// http://your-imagizer-instance.example.com/image.jpg?quality=55
$imageUrl2 = $imagizerClient->buildUrl("image.jpg", [
    "quality" => 55
]);