ID: 11917
User Update by: [EMAIL PROTECTED]
Status: Open
Bug Type: Documentation problem
Operating system: Linux 2.2 SMP
PHP Version: 4.0.6
Description: imageDashedLine() only seems to draw vertical lines
Thanks for the prompt response, and I agree entirely about persistence of functions!
Since I've now seen the deprecation notice under imageDashedLine() and know what to
change in my code, should I marked this as closed?
Previous Comments:
---------------------------------------------------------------------------
[2001-07-06 03:45:16] [EMAIL PROTECTED]
I made this a documentation problem, because it's not really a bug in PHP.
derick
---------------------------------------------------------------------------
[2001-07-06 03:44:19] [EMAIL PROTECTED]
I complained about this too, a while ago (bug 11663).
The way it works in 4.0.6 is using imagesetstyle
with imageline, this is in new documentation at
imagedashedline.
However, IMHO:
<<steam>>
A function should not suddenly stop working. It either
should be dropped, or should continue to work as before.
At least not between minor releases. At least not without
_any_ warnings in release notes. (A mention about GD library
version change is not enough)
_any_ warnings in release notes. (A mention about GD library
version change is not enough)
<</steam>>
I worked around it with this (my client still has 4.0.5, I upgraded
to 4.0.6):
function MDashedLine($image, $x0, $y0, $x1, $y1, $fg, $bg)
{
if (PHP_VERSION == "4.0.5") {
ImageDashedLine($image, $x0, $y0, $x1, $y1, $fg);
}
else {
$st = array($fg, $fg, $fg, $fg, $bg, $bg, $bg, $bg);
ImageSetStyle($image, $st);
ImageLine($image, $x0, $y0, $x1, $y1, IMG_COLOR_STYLED);
}
} // MDashedLine
---------------------------------------------------------------------------
[2001-07-05 20:05:36] [EMAIL PROTECTED]
Using PHP 4.0.6, GD 2.0.1, Apache 1.3.19, and a TrueColor image, this code:
$img = imageCreateTrueColor (64, 64);
$wht = imageColorAllocate ($img, 255, 255, 255);
imageFill ($img, 0, 0, $wht);
$red = imageColorAllocate ($img, 255, 0, 0);
$x1 = 16; $y1 = 16; $x2 = 48; $y2 = 48;
imageDashedLine ($img, $x1, $y1, $x1, $y2, $red);
imageDashedLine ($img, $x1, $y1, $x2, $y2, $red);
imageDashedLine ($img, $x1, $y1, $x2, $y1, $red);
imageDashedLine ($img, $x2, $y2, $x1, $y2, $red);
imageDashedLine ($img, $x1, $y2, $x2, $y1, $red);
imageDashedLine ($img, $x2, $y1, $x2, $y2, $red);
header ("Content-type: image/png");
imagePNG ($img);
Should produce a red square with diagonal lines. Instead it produces only the
vertical lines, in a PNG found at
http://www.kyhm.com/gd/dashedline.png
Configure line:
./configure --with-apxs=/usr/local/sbin/apxs --with-config-file-path=/etc/httpd
--enable-openssl=/usr/local --with-gd=/usr/local --with-jpeg-dir=/usr
--with-tiff-dir=/usr --with-zlib=/usr --with-png-dir=/usr --with-xpm-dir=/usr/X11R6
--with-freetype-dir=/usr/local --with-t1lib=/usr/local --with-mysql=/usr/local
--with-pdflib --with-pgsql --enable-readline=/usr --enable-trans-sid --enable-sockets
--enable-memory-limit --enable-shared --with-mcrypt=/usr/local --enable-ctype
--enable-bcmath --enable-ftp --enable-shmop
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=11917