PHP code example of m1n64 / imageresizer-sdk

1. Go to this page and download the library: Download m1n64/imageresizer-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

m1n64 / imageresizer-sdk example snippets


use M1n64\ImageResizer\Client;

$client = new Client(
    xApiKey: null, // or 'your-api-key', if fault is same as `baseUrl`. Used as image URL host
);

$image = $client->upload('/path/to/image.jpg');
echo $image->status->value; // 'pending', 'ready', etc.

$ping = $client->ping();
echo $ping->message; // "pong"
echo $ping->timestamp->format(DATE_ATOM);

$image = $client->upload('/path/to/image.jpg');

$image = $client->uploadBinary('/path/to/image.jpg');

$imageData = file_get_contents('/path/to/image.jpg');
$image = $client->uploadFromBlob($imageData, 'my.jpg');

$image = $client->get('uuid-here');
echo $image->originalUrl;
echo $image->status->isReady() ? 'Ready' : 'Processing';

Image {
  UuidInterface $id
  string $originalUrl
  ?string $compressedUrl
  int $size
  string $mime
  ImageStatus $status
  ?Thumbnail[] $thumbnails
}

$image->status->isReady();
$image->status->isPending();