back to index

barcode.php

Sun Jan 18 2004, 1:09 AM

Purpose:

Easy output of barcode images in webpages, with size specified in the IMG tag or its CSS definition.

Requirements:

GNU-Barcode with this patch, installed at /usr/local/bin/barcode. (Can be easily rewritten to use a shell wrapper that greps the output from the postscript output of the unpatched version.)

This version also needs PHP with GD patched for GIF support, GD-with-GIF. It's easy to rewrite it for PNG, though - just replace image/gif in the header() call with image/png, and replace imageGIF() with imagePNG(); both changes are at the very end of the code. GIF was chosen for its wide client-side compatibility and general suitability for this kind of task.

Example:

<IMG SRC="/barcode/barcode.php?TYPE=code128&DATA=This+is+a+test" STYLE="width:80mm;height:10mm">

Download:

barcode.php (saved as .txt for easier download)

See also:

List of barcodes and their uses
TEC-IT.com - a vendor of it-does-everything barcode generator
PDF417.com - for 2D barcodes this thing doesn't support yet
KBarCode - a Linux/KDE front-end for barcode printing
PDF417 generator for Linux (SourceForge)

If you have any comments or questions about the topic, please let me know here:
Your name:
Your email:
Spambait
Leave this empty!
Only spambots enter stuff here.
Feedback: