Draw a Line with imageline() in PHP

Description

The following code shows how to draw a Line with imageline().

Example


//from   w w w .j  av a 2 s .  c  om
<?php
header("Content-type: image/png");
$image = imagecreate( 200, 200 );
$red = imagecolorallocate($image, 255,0,0);
$blue = imagecolorallocate($image, 0,0,255 );
imageline( $image, 0, 0, 199, 199, $blue );
imagepng($image);
?>

The code above generates the following result.

Draw a Line with imageline() in PHP




















Home »
  PHP Tutorial »
    Image »




Color
Create
Font
Operation
Shape
Text