Pear Image_Barcode

Do you have questions regarding Pecl or Pear? ask here!

Moderators: egami, macek, gesf

Post Reply

Fri Oct 14, 2011 4:10 am

I have managed to install Pear Image_Barcode and get my scripts to display said barcodes on web pages without any problems, including creating them from text and numeric values from mysql tables.

I'm just feeling my way here and this is were I got stuck.

Code to generate Barcode:

Code: Select all

<?php //genbarcode.php
require_once 'Image/Barcode.php';
$bar_code = $_GET['barcode'];
//	$bar_code = "1023";
	Image_Barcode::draw($bar_code, 'code128', 'png');
I use the following to retrieve and display these Barcodes on web pages.

Code: Select all

'<img src="genbarcode.php?barcode=' . $empno . '" />'
The tutorial I was using says to if you don't want to display the images and would like to do other stuff with them, you would modify the image creation portion of the script like this:

Code: Select all

Image_Barcode::draw($bar_code, 'code128', 'png', false);
What I really need to do now is to retrieve this image into some kind of container where I can get a handle on it and store is as a file or insert it into a blob field.

I have been trying out various 'createimagefrom' functions to no avail.

Any help would be greatly appreciated.

Post Reply