Run PHPcode $ img = imagecreatetruecolor (600,600); $ white = imagecolorallocate ($ img, 255,255,255); imagedashedline ($ img, 20, 20, 500, cannot draw horizontal dotted lines with the GD library of php
Run the following code:
PHP code
$img = imagecreatetruecolor(600, 600);$white = imagecolorallocate($img, 255, 255, 255);imagedashedline($img, 20, 20, 500, 20, $white);imagedashedline($img, 20, 20, 20, 500, $white);header("content-type:image/jpeg");imagejpeg($img);imagedestroy($img);
You will find that the vertical dotted line is OK, but the horizontal dotted line is not displayed. Who knows why?
------ Solution --------------------
PHP code
$ Img = imagecreatetruecolor (600,600); $ white = imagecolorallocate ($ img, 255,255,255); $ red = imagecolorallocate ($ img, 255, 0, 0 ); $ style = array ($ red, $ white, $ white ); imagesetstyle ($ img, $ style); imageline ($ img, 20, 20,500, 20, IMG_COLOR_STYLED); header ("content-type: image/jpeg "); imagejpeg ($ img); imagedestroy ($ img );
------ Solution --------------------
The bug reported by 'michi at marel dot at 'also exists in PHP version 5.1.1. This functions just works with vertical lines! 5.1.1. It should be replaced by a combination of imagesetstyle () and imageline ().
------ Solution --------------------
This functions just works with vertical lines! This function can only draw vertical lines!
------ Solution --------------------
Indeed, the GD database can only draw vertical dotted lines!