您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

用php的GD库画不出水平的虚线解决方法

2025/6/14 12:23:25发布16次查看
用php的gd库画不出水平的虚线
运行一下以下代码
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);
你会发现垂直的虚线没问题,但水平虚线就不显示。有谁知道为什么?
------解决方案--------------------
php code$img = imagecreatetruecolor(600, 600);$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, 20, 20, 500, 20, img_color_styled);header(content-type:image/jpeg);imagejpeg($img);imagedestroy($img);
------解决方案--------------------
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版本发现的bug,反对使用本函数。应该用 imagesetstyle() 和 imageline() 的组合替代之
------解决方案--------------------
this functions just works with vertical lines!该函数只能画垂直线!
------解决方案--------------------
确实,gd库只能画竖直的虚线!

该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product