imagefilledrectangle

PHP 4, PHP 5, PHP 7, PHP 8
imagefilledrectangle - Draw a filled rectangle
Manual
Code Examples

imagefilledrectangle( GdImage$image, int$x1, int$y1, int$x2, int$y2, int$color ): bool

Creates a rectangle filled with color in the given image starting at point 1 and ending at point 2. 0, 0 is the top left corner of the image.

Parameters

image

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

x1

x-coordinate for point 1.

y1

y-coordinate for point 1.

x2

x-coordinate for point 2.

y2

y-coordinate for point 2.

color

The fill color. A color identifier created with imagecolorallocate.

Return Values

Returns true on success or false on failure.

Changelog

Version Description
8.0.0 image expects a GdImage instance now; previously, a resource was expected.

Example of imagefilledrectangle

Show all examples for imagefilledrectangle

PHP Version:


Function imagefilledrectangle:

Image Processing and GD Functions

Most used PHP functions