PHP code example of tin-cat / hdrjpg-sdk-php

1. Go to this page and download the library: Download tin-cat/hdrjpg-sdk-php 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/ */

    

tin-cat / hdrjpg-sdk-php example snippets


use TinCat\HdrjpgSdkPhp\Client;
$client = new Client('iS1nrfLP7KSCkeVlb1hKUL39eyUHsjE+KnLwmh6j'); // Replace with your API Key
$client->convert(
    'example.heic', // Complete path for your Source HDR image file
    [ // An array of variants
        [ // Each variant defines the settings for each resulting image
            'width' => 1200,
            'baseQuality' => 98,
            'format' => 'jpeg-xt'
        ],
        [
            'width' => 800,
            'baseQuality' => 98,
            'format' => 'jpeg-xt'
        ],
        [
            'width' => 300,
            'baseQuality' => 98,
            'gainmapQuality' => 95,
            'format' => 'jpeg-xt'
        ],
        [
            'width' => 1200,
            'baseQuality' => 98,
            'format' => 'jpeg-xl'
        ],
        [
            'height' => 300,
            'baseQuality' => 98,
            'fileName' => 'image-converted',
            'format' => 'avif'
        ]
    ],
    '/tmp' // Output directory to save resulting files to
);