|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41717 Problem with imagethickness() and imagepolygon()
Submitted: 2007-06-16 23:50 UTC Modified: 2007-06-17 10:58 UTC
From: c dot bezemer at student dot tudelft dot nl Assigned: pajoye (profile)
Status: Closed Package: GD related
PHP Version: 5.2.3 OS: windows and linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
8 - 1 = ?
Subscribe to this entry?

 [2007-06-16 23:50 UTC] c dot bezemer at student dot tudelft dot nl
When drawing a polygon with the default thickness everything is fine; but when setting the thickness of the line > 1, I get strange results. It looks as if certain lines of the polygons are not being drawn with the correct thickness.

Reproduce code:
function getPolygon($width, $border_width, $sides)
    $xcen = $width; $ycen = $width; $incr = 360/$sides;
    $angle = 180; $k = 0; $max_height = 0;
    for($j = 0; $j < $sides; $j++)
        $points[$k] = $xcen + $width * sin(deg2rad($angle)) + $border_width;
        $points[$k] = $ycen + $width * cos(deg2rad($angle)) + $border_width;
        $max_height = max($max_height, $points[$k]);
        $angle += $incr;
    $img = imagecreatetruecolor(2*$width+10, $max_height+$border_width+10);
    $bg = imagecolorallocate($img,255,255,255);
    ImageFill($img, 0, 0, $bg);
    imagecolorallocate($img, 255, 255, 255);
    $black = imagecolorallocate($img,0,0,0);
    header("Content-type: image/gif"); imagegif ($img); imagedestroy($img);
getPolygon(100, 5, 9);

Expected result:
For 9 sides, it should be like with a thicker line. 

Actual result:
The output is . This happens for most values of sides.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-17 10:58 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

Thanks for this report!
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Sep 20 12:03:37 2021 UTC