imageline

PHP 4, PHP 5, PHP 7, PHP 8
imageline - Draw a line
Manual
Code Examples

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

Draws a line between the two given points.

Parameters

image

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

x1

x-coordinate for first point.

y1

y-coordinate for first point.

x2

x-coordinate for second point.

y2

y-coordinate for second point.

color

The line 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.

Related Functions

Example of imageline

Show all examples for imageline

PHP Version:


Function imageline:

Image Processing and GD Functions

Most used PHP functions