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.67k stars 402 forks source link

Black block in place of bacorde #106

Closed jomofcw closed 3 years ago

jomofcw commented 4 years ago

Hello !

Thanks for the work on this module. I've updated from 0.x to 2.x and now, i've got a black block in place of my barcode image using : $barcode_generator = new Picqer\Barcode\BarcodeGeneratorJPG(); echo '<img src="data:image/jpg;base64,'.base64_encode($barcode_generator->getBarcode('081231723897',$barcode_generator::TYPE_EAN_13)).'"/>';

Previously, the same code worked well. What's wrong here, please ?

benjivm commented 3 years ago

Also happening to me on Ubuntu 18.04 now. I'm not sure what has changed, but last week everything was working fine.

Edit: This appears to be an issue with the imagick extension. If you remove the extension (or just force the generator to use gd) then all works as expected. Why?

casperbakker commented 3 years ago

What is the php version and imagick version you are using? And could you dump the result of ‘ $barcode_generator->getBarcode('081231723897',$barcode_generator::TYPE_EAN_13)’ as it may contain the error you are looking for.

Ceri48 commented 3 years ago

Hi, Ive a same problem, In my Pc W10 with Wamp server the code as generate correctly but after deployement on OVH server, the same code generate black block.

this a return of : $generator->getBarcode($refFacture, $generator::TYPE_CODE_128);

Capture `PiloteController.php on line 828:

casperbakker commented 3 years ago

Is that the result from the OVH server? As this looks like something like a valid image. This is probably a server config issue with not having installed GD and Imagick and not something with this library.