php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #11917 imageDashedLine() only seems to draw vertical lines
Submitted: 2001-07-05 20:05 UTC Modified: 2001-07-06 07:50 UTC
From: kyhm at kyhm dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.0.6 OS: Linux 2.2 SMP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kyhm at kyhm dot com
New email:
PHP Version: OS:

 

 [2001-07-05 20:05 UTC] kyhm at kyhm dot com
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-06 03:44 UTC] derick@php.net
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-06 03:45 UTC] derick@php.net
I made this a documentation problem, because it's not really a bug in PHP.

derick
 [2001-07-06 04:53 UTC] kyhm at kyhm dot com
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?
 [2001-07-06 07:44 UTC] wez@php.net
It's a GD problem.
GD 2.0.1 is still BETA.
--Wez.
 [2001-07-06 07:50 UTC] derick@php.net
Not a PHP bug, so closing
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 06:01:29 2025 UTC