Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Fix for tiny sizes #29

Open
ScriptWarrior opened this issue Aug 25, 2021 · 1 comment
Open

Fix for tiny sizes #29

ScriptWarrior opened this issue Aug 25, 2021 · 1 comment

Comments

@ScriptWarrior
Copy link

Hi!
Sry for my bad english.
I HAD an issue with tiny size bar (used PHP liblary):
Barcode::gd($image, $black, $col+150, $p*$k+120, 0, "code128", $bankAccount, 1.5, 10)

bars for width between 1 and 3 was a problem.

How do I fix that?

    // GD barcode renderer
    private static function digitToGDRenderer($gd, $color, $xi, $yi, $angle, $mw, $mh, $digit){
        $fn = function($points) use ($gd, $color) {
            $points[2]--; //////////////////////////////////////////// Added that (second X)
            $points[4]--; //////////////////////////////////////////// Added that (third X)
            //print_r($points);
            //exit();
            imagefilledpolygon($gd, $points, 4, $color);
        };
        return self::digitToRenderer($fn, $xi, $yi, $angle, $mw, $mh, $digit);
    }

After that its fine!
Tested with: Honeywell Voyager 1250g

@AlphaOne89
Copy link
Collaborator

AlphaOne89 commented Aug 26, 2021

Nothing happened here for a long time. Using the following file sample-gd.php, I could definitely see your problem and would say the scaling is incorrect. The increase by 1 does not cover the area to be drawn in the image. I don't have a solution yet, and I don't know whether I can deliver one. I haven't dealt with the topic for too long, with the structure of the library there are still fundamental questions.

The question would still be what your use case looks like. For now, I can only recommend that you test Zint Barcode Generator.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants