imagefilledrectangle() function draws a filled rectangle.
imagefilledrectangle( $img, $x1, $y1, $x2, $y2, $color )
image
Use imagecreatetruecolor() to create a blank image.
x1
x coordinate of point 1.
y1
The y coordinate of point 1.
x2
The x coordinate of point 2.
y2
The y coordinate of point 2.
color
Fill color.
The imagefilledrectangle() function returns TRUE successfully and FALSE upon failure.
The following is an example:
<?php // Create an image $img = imagecreatetruecolor(500, 300); $color = imagecolorallocate($img, 0, 128, 128); imagefilledrectangle($img, 30, 30, 470, 270, $color); header("Content-type: image/png"); imagepng($img); imagedestroy($img); ?>
The following is the output:
The above is the detailed content of imagefilledrectangle() function in PHP. For more information, please follow other related articles on the PHP Chinese website!