Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Changes to Barcode.php #418

Closed
wants to merge 9 commits into from
Closed

Changes to Barcode.php #418

wants to merge 9 commits into from

Conversation

TheLoneUs
Copy link

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

ean8 // '73513537'
ean13 // '4006381333931'
ean8 // '73513537'
code39($length = 10) // 'AK*$SJD382'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r/tab/space

@fzaninotto
Copy link
Owner

I'd expect a Code39 generator to generate barcode images...

@nineinchnick
Copy link
Contributor

@fzaninotto why would you expect images? Does other barcode generators output images? Code39 is just another standard, like EAN13.

@fzaninotto
Copy link
Owner

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).

@nineinchnick
Copy link
Contributor

@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.

@fzaninotto
Copy link
Owner

You're probably right. Do you know any good such library, with an open-source license?

@nineinchnick
Copy link
Contributor

I haven't used any yet, a quick search on Packagist.com reveals some interesting hits, like dinesh/barcode and TCPDF.
Some time ago I just called the barcode program through system().

@fzaninotto
Copy link
Owner

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.

@fzaninotto
Copy link
Owner

No news for too long, closing.

@fzaninotto fzaninotto closed this May 20, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants