Image

Image #

PhpTui\Tui\Extension\ImageMagick\Widget\ImageWidget

Render an image on a canvas matching the dimensions of the image.

Example #

Show code
<?php

declare(strict_types=1);

use PhpTui\Tui\DisplayBuilder;
use PhpTui\Tui\Extension\ImageMagick\ImageMagickExtension;
use PhpTui\Tui\Extension\ImageMagick\Widget\ImageWidget;

require 'vendor/autoload.php';

$display = DisplayBuilder::default()
    ->addExtension(new ImageMagickExtension())
    ->build();
$display->draw(
    new ImageWidget(path: __DIR__ . '/../shape/example.jpg'),
);

Parameters #

Configure the widget using the builder methods named as follows:

NameTypeDescription
pathstringAbsolute path to the image
markerPhpTui\Tui\Canvas\Marker|nullCanvas marker to use, defaults to Marker::HalfBlock