Use PHP's GD library to draw horizontal dashed lines
Run the following code
PHP Code
$img = imagecreatetruecolor, $white = Imagecolorallocate ($img, 255, 255, 255); Imagedashedline ($img, 20, 20, 500, ($white), Imagedashedline ($img, (a), $white), header ("Content-type:image/jpeg"), imagejpeg ($IMG); Imagedestroy ($IMG);
You will find that the vertical dashed line is fine, but the horizontal dashed line is not displayed. Who knows why?
------Solution--------------------
PHP code
$img = Imagecreatetruecolor (+); $white = Imagecolorallocate ($img, 255, 255, 255); $red = Imagecolorallocate ($img, 255, 0, 0); $style = Array ($red, $red, $red, $red, $red, $white, $white, $white, $white, $white); Imagesetstyle ($img, $style); Imageline ($img ("Content-type:image/jpeg"); imagejpeg ($img); Imagedestroy ($img);
------Solution--------------------
The bug reported by ' Michi @ Marel dot at ' also exists in PHP version 5.1.1. This functions just works with vertical lines! 5.1.1 version found the bug, against the use of this function. The
------solution should be replaced with the combination of Imagesetstyle () and Imageline ()--------------------
This functions just works with vertical Lines! This function can only draw a vertical line!
------Solution--------------------
Indeed, the GD library can only draw vertical dashed lines!