This is a function to make a dotted line. It accepts (it actually requires) 7 parameters and returns 1 if everything went OK and 0 if there was a problem.
int imagelinedotted ( resource im, int x1, int y1, int x2, int y2, int dist, int col )
imagelinedotted() draws a line from x1, y1 to x2, y2 (top left is 0, 0) in image im of colour col where dist defines the distance (measured in pixels) between one dot and another.
<?php
function imagelinedotted ($im, $x1, $y1, $x2, $y2, $dist, $col) {
$transp = imagecolortransparent ($im);
$style = array ($col);
for ($i=0; $i<$dist; $i++) {
array_push($style, $transp); }
imagesetstyle ($im, $style);
return (integer) imageline ($im, $x1, $y1, $x2, $y2, IMG_COLOR_STYLED);
imagesetstyle ($im, array($col)); }
?>