Sunday 14 February 2010

ISBN barcode code

Geeky, I know, but I'm kind of proud of this...a little bit of php that generates a barcode from any 13 digit string. It's most commonly used for book ISBN barcodes, but is also a more generic system (EAN-13) used for a huge number of products, from cheese to tobacco. The code needs a couple of images, stored in a folder called "barcode" - one black (1.gif), one white (0.gif), a pixel or two wide and as high as you want (20px seems to do the job nicely).

The first function converts a 10 digit ISBN to 13 digits (useful in itself), and the second one does the barcode, calling the first where necessary. It presents the final barcode in a borderless table, it seems to sit better in the various places you could use it in HTML or PHP.

It's free to would be nice, but I'm not going to get stroppy ;)

Click here for a hopefully public me if you want it and can't get to it. There's no [code] tags for blogger as far as I can see yet.

No comments:

Post a Comment