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);

?>
true

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>';

?>
<!doctype html>
<html>
<body>
    <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAA/ElEQVR4nO3WMQrDQAxFQfv+h3aaNCIJQiLFZ5lXmYzSCVbXJSms53noL72/2n2X3+n749O+/p9eNmutZYK2Kkk6tcx3J0TdWQN1wQ/UZi21TNBWJUmnlvnuhKg7a6Au+IHarKWWCdqqJOnUMt+dEHVnDdQFP1CbtdQyQVuVJJ1a5rsTou6sgbrgB2qzllomaKuSpFPLfHdC1J01UBf8QG3WUssEbVWSdGqZ706IurMG6oIfqM1aapmgrUqSTi3z3QlRd9ZAXfADtVlLLRO0VUnSqWW+OyHqzhqoC36gNmupZYK2Kkk6tcx3J0TdWQN1wQ/UZi21TNBWpT/1AsqX2hKrIOg5AAAAAElFTkSuQmCC">
</body>
</html>
HomeMenu