PHP GD draw line


 

PHP GD draw line

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

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

Ads