Jump to content

GD Library Barcodes


Dysan

Recommended Posts

I am interested in creating Gift Vouchers on the fly for my online shop.

 

Each voucher will have its only barcode, that is activated, on point of sale (barcode is stored in a database). So if somebody manages to print the voucher that hasn't be activated/purchased, then the barcode won't be in the database, an therefore won't work.

 

How do I create the vouchers with barcodes on the fly, using the GD library? I am interested in coding this my-self, without using classes, but I need a bit of guidance.

 

Can anybody help?

Link to comment
https://forums.phpfreaks.com/topic/81380-gd-library-barcodes/
Share on other sites

It would depend on what encoding you want to use for your barcodes, for example, the specification for 'Code 93' encoding can be found on this Wikipedia page, which also has a link on it to a further site that has specifications for many other encoding types.

Link to comment
https://forums.phpfreaks.com/topic/81380-gd-library-barcodes/#findComment-413050
Share on other sites

A good guide to building a Code 39 barcode can be found here and PHPs image functions can be found at http://php.net/gd. If you have no idea where to start, I think you might be jumping in at the deep end - Why not try a library or class that can make this easier for you?

Link to comment
https://forums.phpfreaks.com/topic/81380-gd-library-barcodes/#findComment-413067
Share on other sites

A good guide to building a Code 39 barcode can be found here and PHPs image functions can be found at http://php.net/gd. If you have no idea where to start, I think you might be jumping in at the deep end - Why not try a library or class that can make this easier for you?

I suppose the place to start, would be store the available characters inside an array, along with their binary values. Would you agree? How do I create the different bar widths?
Link to comment
https://forums.phpfreaks.com/topic/81380-gd-library-barcodes/#findComment-413165
Share on other sites

get some fonts for barcodes here:

http://freebarcodefonts.dobsonsw.com/

 

 

learn how to write text on images using your supplied fonts:

http://us2.php.net/manual/en/function.imagefttext.php (freetype, opentype fonts)

http://us2.php.net/manual/en/function.imagettftext.php (truetype fonts)

 

concept:

you are creating images (jpeg,png, gif) on the fly with the GD library an associated functions in PHP

1. create blank image

2. write text on image with barcode font

 

there are many tutorials on how to create sample images on google and internet, but writing text on images is quite simple out of all gd uses

Link to comment
https://forums.phpfreaks.com/topic/81380-gd-library-barcodes/#findComment-413651
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.