PHP code example of artwl / tinify-laravel

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

    

artwl / tinify-laravel example snippets


Artwl\LaravelTinify\LaravelTinifyServiceProvider::class,

'Tinify' => Artwl\LaravelTinify\Facades\Tinify::class

use Tinify;

$result = Tinify::fromFile('\path\to\file');
$result -> toFile('\path\to\save');

use Tinify;

$result = Tinify::fromFile('\path\to\file');
$result -> resize(array(
    "method" => "fit",
    "width" => 150,
    "height" => 100
));
$result -> toFile('\path\to\save');