PHP code example of felixarntz / terminal-image

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

    

felixarntz / terminal-image example snippets


use FelixArntz\TerminalImage\TerminalImage; // excluded in the following examples

echo TerminalImage::file('unicorn.jpg');

$data = file_get_contents('https://example.com/unicorn.jpg');
echo TerminalImage::buffer($data);

echo TerminalImage::file('unicorn.jpg', ['width' => 40]);

echo TerminalImage::file('unicorn.jpg', ['height' => 20]);

echo TerminalImage::file('unicorn.jpg', ['width' => '50%']);

echo TerminalImage::file('unicorn.jpg', ['width' => 60, 'height' => 20]);

echo TerminalImage::file('unicorn.jpg', [
    'width' => 60,
    'height' => 20,
    'preserveAspectRatio' => false,
]);