drawLine() ignores line width with GD <= 2.1.0 · Issue #1304 · Intervention/image · GitHub
Skip to content

drawLine() ignores line width with GD <= 2.1.0 #1304

Open

Description

@anhao

Describe the bug
I am using Image v3.4.0 , I used drawLine to draw lines, it has always been 1px

The same result was obtained using the DrawPixelLine of #1298

Code Example

$image->drawLine(function (LineFactory $line)use($listHeight) {
    $line->from(980, 20); // starting point of line
    $line->to(980, $listHeight-20); // ending point
    $line->color('#723e4b'); // color of line
    $line->width(5); // line width in pixels
});

Images
test

Environment (please complete the following information):

  • PHP Version: PHP 8.1.25 (cli)
  • OS: windows
  • Intervention Image Version: v3.4.0
  • GD or Imagick: GD
gd

GD Support => enabled
GD Version => bundled (2.1.0 compatible)
FreeType Support => enabled
FreeType Linkage => with freetype
FreeType Version => 2.9.1
GIF Read Support => enabled
GIF Create Support => enabled
JPEG Support => enabled
libJPEG Version => 8
PNG Support => enabled
libPNG Version => 1.6.34
WBMP Support => enabled
XPM Support => enabled
libXpm Version => 30512
XBM Support => enabled
WebP Support => enabled
BMP Support => enabled
AVIF Support => enabled
TGA Read Support => enabled

Directive => Local Value => Master Value
gd.jpeg_ignore_warning => 1 => 1
···

Activity

  1. olivervogel commented on Feb 29, 2024

    @olivervogel
    Member

    This is a really strange error that I can't really explain at the moment.

    As described in #1298 and here, the width is apparently discarded when imageantialias() is activated. A workaround could be to use a custom modifier that works without the function but of course also has the disadvantage that the line is not antialiased. How this could work I already described here.

    However, I am still wondering, because in my environment, I have no problems and everything works as expected. I can explain this by the fact that the bug was fixed at some point. I see that you are using GD version bundled (2.1.0 compatible).

    I am currently running GD 2.3.3, maybe you can try to switch to this newer version as well.

    My Environment

    • PHP Version: PHP 8.3.2
    • OS: MacOS
    • Intervention Image Version: 3.4.0
    • GD or Imagick: GD
    gd
    
    GD Support => enabled
    GD headers Version => 2.3.3
    GD library Version => 2.3.3
    FreeType Support => enabled
    FreeType Linkage => with freetype
    GIF Read Support => enabled
    GIF Create Support => enabled
    JPEG Support => enabled
    PNG Support => enabled
    WBMP Support => enabled
    XPM Support => enabled
    XBM Support => enabled
    WebP Support => enabled
    BMP Support => enabled
    AVIF Support => enabled
    TGA Read Support => enabled
    
  2. changed the title [-]drawLine width() not working[/-] [+]drawLine width() not working with GD driver[/+] on Feb 29, 2024
  3. anhao commented on Mar 1, 2024

    @anhao
    Author

    On linux, using gd 2.3.3 is possible , But in window the default gd version is 2.1.0

  4. changed the title [-]drawLine width() not working with GD driver[/-] [+]drawLine() ignores line width with GD <= 2.1.0[/+] on May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions