Home Tutorial Php Phpgd PHP GD draw line


Share on Google+Share on Google+
PHP GD draw line
Posted on: November 4, 2009 at 12:00 AM
This example shows how to draw line using php gd Library.


header ("Content-type: image/jpeg");

$handle = ImageCreate (130, 50) or die ("Cannot Create image");

$bg_color = ImageColorAllocate ($handle, 255, 0, 0);

$txt_color = ImageColorAllocate ($handle, 255, 255, 255);

$line_color = ImageColorAllocate ($handle, 0, 0, 0);

ImageLine($handle, 65, 0, 130, 50, $line_color);

ImageJpeg ($handle);


After running the program you will get the following output


Related Tags for PHP GD draw line:

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: November 4, 2009

Recommend the tutorial

Advertisements Advertisements