php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11333 ImageDashedLine and ImageSetThickness problems
Submitted: 2001-06-07 12:45 UTC Modified: 2001-06-11 21:47 UTC
From: fierens at irceline dot be Assigned:
Status: Closed Package: GD related
PHP Version: 4.0 Latest CVS (2001-06-07) OS: redhat 7.0
Private report: No CVE-ID: None
 [2001-06-07 12:45 UTC] fierens at irceline dot be
I've installed php4.0 latest CVS with gd2.0.1
It seems that the functions ImageDashedLine and ImageSetThickness are not working correctly.
ImageDashedLine works for vertical lines but not for horizontal lines (?).
ImageSetThickness is not working at all. 

Frans Fierens
Brussels, Belgium

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-07 15:17 UTC] sniper@php.net
Are you sure that imagedashedline() isn't broken in GD 2.0.1
library itself? As the function in PHP hasn't changed for
a long time now. Would it be possible for you to try
this with GD 1.8.4 ? Also, do you get some error about
imagesetthichkness()?? Define 'not working at all'..

--Jani
+



 [2001-06-07 17:08 UTC] fierens at irceline dot be
Jani,

I've tried with gd1.8.4 and have the same problem.
it seems that ImageDashedLine is not broken in gd2 but in the gd2 readme you can read this:

"void gdImageDashedLine(gdImagePtr im, int x1, int y1, int x2, int y2,int color) _(FUNCTION)_
gdImageDashedLine is provided _solely for backwards
compatibility with gd 1.0. New programs should draw dashed
lines using the normal gdImageLine function and the new
gdImageSetStyle function."

I looked for ImageSetStyle in php4 but this function is not supported.

the problem with the ImageSetThickness function is that is recognised by the latest CVS but it does not do anything.

the two things are illustrated in the script below :

example script:

<?
// Send out the header info and create the initial blank canvas 
  Header( "Content-type: image/png");

$image = imagecreate(100,100);
$blue = ImageColorAllocate($image,0,0,255);
$red = ImageColorAllocate($image,255,0,0);
$grey = ImageColorAllocate($image,192,192,192);

ImageFilledRectangle($image,0,0,100,100,$grey); 

$th=5;
//$th can be whatever number : rectangle thickness does not change
ImageSetThickness($image,$th);
ImageRectangle($image,10,10,50,50,$blue);

//vertical dashed line OK
ImageDashedLine($image,80,10,80,50,$red);

//horizontal dashed line ???
ImageDashedLine($image,10,70,80,70,$red);

// output the GIF to the browser and free up memory 
ImagePng($image); 
ImageDestroy($image); 

?> 

Frans   
 [2001-06-11 21:47 UTC] sniper@php.net
I have fixed the bug with imagesetthickness() in CVS and
in the release branch for PHP 4.0.6.

The issue with imagedashedline() although is not solved
and won't be as it is deprecated in the GD library.
I have added documentation for imagesetstyle() into
the documentation CVS (unfortunately the online manual
isn't updated for a while..) and also put a note to 
imagedashedline() docs to inform people that they should
use imagesetstyle + imageline instead.

There seems to be some problems with creating thick dashed
lines with the imagesetstyle+imageline combination though.
But the bug in this case is in the GD library itself.

--Jani

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Oct 12 19:01:28 2024 UTC