Patch based on the source code used for PHP bug 43475. The functions below come from Q-lib, my own library. Full authorisation to be used in the public domain. Problem 1 Horizontal lines aren't rendered correctly. To me it is weird that vertical lines work fine. In any case, this is fixed by ImageLineStyled(). Problem 2 Style usage isn't clearly documented. I will add ImageStyleThicken() to the function notes. To my personal opinion, the way styles are applied IS CORRECT. When styles would be applied linear instead, things like rainbow lines and chained lines wouldn't be possible (unless using a very slow ImageSetPixel() variant). ,,,,,[,]) --> is the image resource (see imagecreatetruecolor()). , are the from-coordinates. , are the to-coordinates. is the style array (see imagesetstyle()). Use ImageStyleThicken() if the style is linear and is greater than 1. is the line thickness; default 1. is true on success or false on failure. */ function ImageLineStyled($_1,$_2,$_3,$_4,$_5,$_6,$_7 = 1) { static $a; imagesetthickness($_1,$_7); if ($_6!==$a) imagesetstyle($_1,$a = $_6); if ($_3!=$_5 or $_7<=1) return imageline($_1,$_2,$_3,$_4,$_5,IMG_COLOR_STYLED); if ($_2>$_4) { $i = $_2; $_2 = $_4; $_4 = $i; } $_3 -= $_7>>1; $_5 = ($i = $_3)+$_7-1; do { foreach ($a as $x) { if ($x>=0) imagesetpixel($_1,$_2,$_3,$x); if (++$_3>$_5) { if (++$_2>$_4) return true; $_3 = $i; } } } while (true); } /* ImageStyleThicken(,) --> is the style array for a thickness of 1 (see imagesetstyle()). is the new thickness to apply (see imagesetthickness()). is the style array suitable for the given thickness. */ function ImageStyleThicken($_1,$_2) { $a = array(); foreach ($_1 as $x) { $i = $_2; do $a[] = $x; while (--$i>0); } return $a; } ?>