HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

imagesettile

Description

The imagesettile of Image for PHP set the tile image for filling.

Syntax

imagesettile(
    GdImage $image,
    GdImage $tile
): bool

Parameters

image

A GdImage object, returned by one of the image creation functions, such as imagecreatetruecolor().

tile

The image object to be used as a tile.

Return

Returns true on success or false on failure.

Examples

1 · return

<?

$width = 100;
$height = 100;
$image = imagecreate($width, $height);

$width = 100;
$height = 100;
$tile = imagecreate($width, $height);

$return = imagesettile($image, $tile);

var_export($return);
myfunction Hello World!

2 · base64

<?

$width = 100;
$height = 100;
$image = imagecreatetruecolor($width, $height);

$width = 10;
$height = 10;
$tile = imagecreatetruecolor($width, $height);

$red = 255;
$green = 255;
$blue = 255;
$color = imagecolorallocate($tile, $red, $green, $blue);

$center_x = 5;
$center_y = 5;
$width = 5;
$height = 5;
imagefilledellipse($tile, $center_x, $center_y, $width, $height, $color);

imagesettile($image, $tile);

$x1 = 0;
$y1 = 0;
$x2 = 100;
$y2 = 100;
$color = IMG_COLOR_TILED;
imagefilledrectangle($image, $x1, $y1, $x2, $y2, $color);

ob_start();

    imagepng($image);

$output = ob_get_clean();

echo '<!doctype html>
<html>
<body>
    <img src="data:image/png;base64,' . base64_encode($output) . '">
</body>
</html>';
{closure:/home/osbocom/public_html/php/demo/index.php:3} Hello World!