PHP code example of mh / imagetastic

1. Go to this page and download the library: Download mh/imagetastic 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/ */

    

mh / imagetastic example snippets




use Imagetastic\Client;

ame
$project = 'alien-dispatch-8258';

// original picture you want to upload and create thumbnail
//$imageUrl = '/tmp/my-image-file.jpg';
$imageUrl = 'https://images.pexels.com/photos/974229/pexels-photo-974229.jpeg?auto=compress&cs=tinysrgb&h=800&w=1200';

// dimentions for the thumbnail
$dimentions = [
    'height' => 300,
    'width' => 400,
];

// your client key, can be downloaded from your google cloud console
$client = new Client(__DIR__.'/client.json', $project);

$r = $client->process($imageUrl, $dimentions);
var_dump($r);