-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Conversation
It was generating the wrong checksum for ean8 barcodes, which is fixed now.
ean8 // '73513537' | ||
ean13 // '4006381333931' | ||
ean8 // '73513537' | ||
code39($length = 10) // 'AK*$SJD382' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r/tab/space
I'd expect a Code39 generator to generate barcode images... |
@fzaninotto why would you expect images? Does other barcode generators output images? Code39 is just another standard, like EAN13. |
True. Let's leave barcode images aside for now, but it would make sense to build one (although it implies a dependency over an image manipulation tool, like gd or Imagemagick). |
@fzaninotto I think its out of Faker's scope. It's like a different output format for the barcode data, image instead of a string. There are libs that do that, taking a barcode as an input. |
You're probably right. Do you know any good such library, with an open-source license? |
I haven't used any yet, a quick search on Packagist.com reveals some interesting hits, like dinesh/barcode and TCPDF. |
Any news on the code review? If this fixes a broken formatter, I'd like this PR to get merged, but if the code stays like that, I'll just close it. |
No news for too long, closing. |
I've made several changes to Barcode.php:
-ean8 barcodes were not generating the correct check digit due to a - instead of a + in the logic, fixed, and they now verify using online ean8 verification tools.
-added code39 barcodes, A-Z, 0-9, some special characters.
-Changed logic for generating ean barcodes to improve speed. In my test it resorted in faster barcode creation for 100000 ean barcodes.
-Added a ref to the readme for the new code39 generation