Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
anhao opened this issue Feb 29, 2024 · 2 comments
Open

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

anhao opened this issue Feb 29, 2024 · 2 comments

Comments

@anhao
Copy link

anhao commented Feb 29, 2024

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
···
@olivervogel
Copy link
Member

olivervogel commented Feb 29, 2024

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

@olivervogel olivervogel changed the title drawLine width() not working drawLine width() not working with GD driver Feb 29, 2024
@anhao
Copy link
Author

anhao commented Mar 1, 2024

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

@olivervogel olivervogel changed the title drawLine width() not working with GD driver drawLine() ignores line width with GD <= 2.1.0 May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants