PHP library for the lossless image compression API
Clone or download
Latest commit ce24a06 Aug 29, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src handle HTTP errors Nov 27, 2017
tests handle HTTP errors Nov 27, 2017
.gitignore handle HTTP errors Nov 27, 2017
README.md initial commit Jun 18, 2015
composer.json handle HTTP errors Nov 27, 2017

README.md

PHP Library for the Optimus API

Lossless image compression API

More details about Optimus are available on optimus.io.

Please let us know if you got questions or feedback: Optimus Support

Requirements

  • PHP 5.3 or above
  • PHP Curl Extension

Usage

<?php

require '/path/to/src/optimus.php';

// create object and pass API license key
$optimus = new Optimus('<your_license_key>');

// optimize image
$result = $optimus->optimize('/path/to/image.jpg');

// save optimized image
file_put_contents('/path/to/image.jpg', $result);

...

?>

Convert to WebP image format

// optimize image and convert to webp
$result = $optimus->optimize('/path/to/image.jpg', 'webp');

// save optimized image with webp extension
file_put_contents('/path/to/image.webp', $result);