Share on Google+Share on Google+

PHP GD dashed line

This example shows how to display dashed line in php gd.


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

$width = 350;

$height = 360;

$im = ImageCreateTrueColor($width, $height);

ImageAntiAlias($im, true);

$white = ImageColorAllocate($im, 255, 255, 255);

ImageFillToBorder($im, 0, 0, $white, $white);

$black = ImageColorAllocate($im, 0, 0, 0);

ImageLine($im, 10, 10, 250, 300, $black);

ImageDashedLine($im, 30, 10, 280, 300, $black);




After running the program you will get the following output


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

Share this Tutorial 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.