apanaj/client-optimager

There is no license information available for the latest version (dev-devel) of this package.

Client For Image Optimizer Service.

dev-devel 2018-01-23 11:03 UTC

This package is not auto-updated.

Last update: 2024-11-10 05:19:33 UTC


README

php client for image optimizer service.

// Resize Image:
// from url
$c = new \Apanaj\Optimager\Client('http://apanaj_optimizer-image');
$img = $c->optimize(
    (new \Apanaj\Optimager\Client\Command\Optimize())
        ->fromUrl('https://helloworld.co.nz/images/helloworld-logo.jpg')
        ->crop(90, 90)
        ->quality(100)
);

header('Content-Type: image/jpeg');
echo stream_get_contents($img);
die;


// Resize Image:
// from stream or file
$c = new \Apanaj\Optimager\Client('http://apanaj_optimizer-image');
$img = $c->optimize(
    (new \Apanaj\Optimager\Client\Command\Optimize())
        ->fromStream(fopen('https://helloworld.co.nz/images/helloworld-logo.jpg', 'rb'))
        ->resize(90, 90)
        ->quality(100)
);