PHP GD draw line

This example shows how to draw line using php gd Library.

 
 

Share on Google+Share on Google+

PHP GD draw line

Ads

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

Advertisements

Ads

Posted on: November 4, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles