ingowalther / image-minify-php-client
PHP Implementation of Image Minify API
Installs: 27
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/ingowalther/image-minify-php-client
Requires
- guzzlehttp/guzzle: 6.1.0
This package is not auto-updated.
Last update: 2025-10-25 23:37:34 UTC
README
Basic PHP-Implementation of Image Minify API
see https://github.com/ingowalther/image-minify-api
Installation
composer require ingowalther/image-minify-php-client
Usage
$client = new \IngoWalther\ImageMinifyPhpClient\Client\ImageMinifyApiClient($serverUrl, $apiKey);
| Parameter | Description |
|---|---|
| $serverUrl | The url of your Image Minify API Installation (e.g. http://example.com) |
| $apiKey | Your API-Key |
Get compressed image
Returns a "CompressedImage" Object
/** @var \IngoWalther\ImageMinifyPhpClient\Response\CompressedImage $compressedImage */ $compressedImage = $client->getCompressedImage($imagePath); // The size before compression $oldSize = $compressedImage->oldSize; // The size after compression $newSize = $compressedImage->newSize; // The saving in percent $saving = $compressedImage->saving; // The binary-content of the compressed image $binaryContent = $compressedImage->binaryContent;
Write compressed image
Compresses the given image and writes the result to the targetpath
$success = $client->writeCompressedImage($imagePath, $newImagePath);