Link to home
Start Free TrialLog in
Avatar of Steynsk
SteynskFlag for Netherlands

asked on

Make multiple barcodes with simple script

Hi Expert,

I've found this exelent working PHP script that makes the barcodes. I've found it at this page.

<?
include "Barcode39.php"; 
$bc = new Barcode39("123-ABC"); 
$bc->barcode_text_size = 5; 
$bc->barcode_bar_thick = 4; 
$bc->barcode_bar_thin = 2; 
$bc->draw();
?>

Open in new window


Would there be a simple way to make this script write multiple barcodes with different values in one page?
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Julian is correct and it should work in the same way as any streaming product with the IMG tag. For example:
http://support.idautomation.com/php-barcode/idautomation-code128.php?D=Testing123456
returns an image.
Just create a new Barcode39 each time you need to. Put the codes you want in an array and loop through them:

include "Barcode39.php";
$codes = array("Code 1", "Code 2", "Code 3");
		
foreach ($codes as $code):
    $bc = new Barcode39($code); 
    $bc->barcode_text_size = 5; 
    $bc->barcode_bar_thick = 4; 
    $bc->barcode_bar_thin = 2; 
    $bc->draw();
endforeach;

Open in new window

Avatar of Steynsk

ASKER

Julian,

Thank you very much for the answer to my question and the advise.

Kind regards,

Steynsk
You are welcome.