Another Quick Script to Generate PHP Barcodes

Posted on June 15th, 2012 in General by Brandon

You’ll need the PEAR Image_Barcode library for this, which can be installed with the command

#pear install Image_Barcode

Once that is installed, the PHP Code is quite simple. Just use the following:

<?php

$number = isset($_GET['number']) ? $_GET['number'] : '';

require_once 'Image/Barcode.php';
header('Content-type: image/png');
Image_Barcode::draw($number, 'code128', 'png');

?>

Post a comment

Please copy the string PDu0Wk to the field below: