Illep
Illep

Reputation: 16851

Barcode reader in sencha-touch

I have been asked to take an image of a bar code, and read its content.

So far, i know how to access the camera and take the image. I don't know how to read the barcode. Can someone show me an example/tutorial where i could do this easily. Or if there is a javascript library where i could make use of ?

2.) Since Sencha-Touch is Javasript, and if the barcodr reader library is also in javascript, I could identify the barcode from the Phone it self (without having to upload the image to the server, for the server to read the content)?

i found this in the net, but not sure how to use it

Upvotes: 2

Views: 4341

Answers (1)

StevenLooman
StevenLooman

Reputation: 381

Load this script from your page: http://tobeytailor.s3.amazonaws.com/get_barcode_from_image/get_barcode_from_image.js (i.e.: )

Then, if you have your image captured by the camrea in an tag in your page with an id-attribute, call the function getBarcodeFromImage(..) with the id-attribute of the tag. As shown in the example found here http://tobeytailor.s3.amazonaws.com/get_barcode_from_image/index.html.

Some example JavaScript:

var imgId = 'barcode'; var barcode = getBarcodeFromImage(imgId); alert('The scanned barcode is: ' + barcode);

Hope this helps.

PS The script is released under the MIT license. You can use the barscanner-code freely, but you have to include the copyright text.

Upvotes: 1

Related Questions