barcode icon indicating copy to clipboard operation
barcode copied to clipboard

Fix for tiny sizes

Open ScriptWarrior opened this issue 4 years ago • 1 comments

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

ScriptWarrior avatar Aug 25 '21 11:08 ScriptWarrior

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.

AlphaOne89 avatar Aug 26 '21 02:08 AlphaOne89