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:
Name | Type | Description |
---|---|---|
path | string | Absolute path to the image |
marker | PhpTui\Tui\Canvas\Marker|null | Canvas marker to use, defaults to Marker::HalfBlock |