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

imagesetthickness

Description

The imagesetthickness of Image for PHP set the thickness for line drawing.

Syntax

imagesetthickness(
    GdImage $image,
    int $thickness
): bool

Parameters

image

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

thickness

Thickness, in pixels.

Return

Returns true on success or false on failure.

Examples

1 · return

<?

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

$thickness = 10;

$return = imagesetthickness($image, $thickness);

var_export($return);

?>
true

2 · base64

<?

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

$thickness = 10;
imagesetthickness($image, $thickness);

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

$x1 = 0;
$y1 = 0;
$x2 = 100;
$y2 = 100;
imageline($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/gAIDAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAB9ElEQVR4nO3dOWKDQBAF0cL3vzMOLFlCmg2YpbcKIfn9IjK2fd9JtW1b8rnnfnIvcoiey2IRXl+VsAivYxUswuutOhbh9awJi/ACYOMMhPPvicfx4dXS6/LwqnY4O7zKfd4cXoUSB4dXrvS14ZUse2p4fVe6M7w+qhwZXu/VLwyv/5rOC6+/Wm8LL9qxCK9TWLj3On2SZ68r97j1uniMT6/rlzj0unWGN6+7N7jy6nCAH68+6514dZvuwavnbvNenUfb9uq/2LDXkLlWvUZtNek1cKg9r7ErjXkNn2jJa8Y+M16TxtnwmrfMgNfUWdq9Zm9S7bVgkF6vNWuUei2botFr5Q51XotH6PJav0CR13os9HiJwEKJlxQsNHgJwkK8lywsZHuJw0Kwl0QspHoJxUKkl1ws5HmJxkKYl3QsJHkpwEKMlw4sZHipwUKAlyYsVnspw2Kplz4s1nmpxGKRl1YsVngpxmK6l24s5nqpx2KilwUsZnkZwWKKlx0sxnuZwmKwlzUsRnoZxGKYl00sxniZxWKAl2UsensZx6Krl30s+nm5wKKTlxcseng5wuK2ly8s7nm5w+KGl0csrno5xeKSl18sznu5xuKkl3csTnkN3aGlRq/AetTiFVivql6BdajsFVifFbwCK1H2b6KTd2gp6fULsAksULu3SBoAAAAASUVORK5CYII=">
</body>
</html>
HomeMenu