picqer / php-barcode-generator

Barcode generator in PHP that is easy to use, non-bloated and framework independent.
GNU Lesser General Public License v3.0
1.66k stars 400 forks source link

using FORM as array like name='data[]' #178

Closed SwayerPT closed 1 year ago

SwayerPT commented 1 year ago

I'm trying to create a FORM to generate more than 1 CODE128 images using the codes on INPUTS with the name DATA[]. But.. says that $code on VENDOR should be a string.

Fatal error: Uncaught TypeError: Picqer\Barcode\BarcodeGenerator::getBarcodeData(): Argument #1 ($code) must be of type string, array given, called in E:\xampp\htdocs\MagePlatform\MEpos\assets\lib\Barcode\vendor\picqer\php-barcode-generator\src\BarcodeGeneratorPNG.php on line 54

There is a way to correct this thing to generate more as array?

casperbakker commented 1 year ago

This library can create 1 image at a time. If you want to create a lot of them, loop through the array in your own code and generate as much images (one by one) with the this generator, and combine the images afterwards in any way you want.