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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.