Dysan Posted December 12, 2007 Share Posted December 12, 2007 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? Quote Link to comment Share on other sites More sharing options...
zq29 Posted December 12, 2007 Share Posted December 12, 2007 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. Quote Link to comment Share on other sites More sharing options...
Dysan Posted December 12, 2007 Author Share Posted December 12, 2007 I will need to use Code 39. How do I code a Code 39 barcode to be created on the fly? Quote Link to comment Share on other sites More sharing options...
zq29 Posted December 12, 2007 Share Posted December 12, 2007 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? Quote Link to comment Share on other sites More sharing options...
zq29 Posted December 12, 2007 Share Posted December 12, 2007 On second thoughts, to make this easier, you could find/download a Code 39 font and use that in your image creation script... Quote Link to comment Share on other sites More sharing options...
Dysan Posted December 12, 2007 Author Share Posted December 12, 2007 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? Quote Link to comment Share on other sites More sharing options...
zq29 Posted December 13, 2007 Share Posted December 13, 2007 How do I create the different bar widths? imagefilledrectangle() Quote Link to comment Share on other sites More sharing options...
dsaba Posted December 13, 2007 Share Posted December 13, 2007 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.