Intervention / Intervention/image

drawLine() ignores line width with GD <= 2.1.0

Open
#1,304 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

investigation-needed
Dominant language
PHP
Stars
14.4k
Forks
1.5k
Avg merge
17h 51m
Merged PRs (30d)
11

Description

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 https://github.com/Intervention/image/issues/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
···

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the GD implementation reached by drawLine() and reproduce the supplied PHP example with GD 2.1.0 compatibility. Done means the requested width of 5 produces a visibly wider line under GD, with the corrected behavior verified by the project's tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.