Home Tutorial Php Phpgd PHP GD draw line

 
 

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

<?php

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:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.