I'm looking for a way to identify EAN / UPC (primarily EAN) barcode numerals from a camera-captured image in PHP or Javascript. I've found a few libraries for Java but ideally would like one of PHP or JS to manage it. Not sure if feasible, but any advice appreciated!

Edit: tried http://zxing.org/w/decode.jspx with some sample images from iPod Touch camera, with mixed success.


There is probably going to be a server-side tool for this. Can you install / use command-line tools? What system are you on?

Written by Pekka

At the moment on Unix/Apache VPS, but just wondering how feasible it is on any platform.

Written by codinghands

Also, yes, have root access.

Written by codinghands

Accepted Answer

I did a project where this was a requirement so we ended up using this library. http://sourceforge.net/projects/zbar/

A fellow consultant working with me wrote up an image crop tool that allowed a user to crop an uploaded image down to just the barcode, this was then shoved into a ghetto MQ using sqlite, where a resident agent running on the machine polled sqlite and processing pending records ( transaction_id, path2file, date of trx ) reported back to the application via a web service call the result.

I was the one that did the R&D for this feature request and I don't remember any bar scanning libraries for PHP plus Python isn't so painful to learn, just got to master daemonizing a python script to run as a service then read up on urllib2 for sending the response back to the PHP app. We did it in 48 man hours between two people, add another 15-20 hours to learn enough about Python and it should be doable.

Written by David
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki