| 
	
 | 
 Posted by Hendri Kurniawan on 05/01/07 22:37 
KDawg44 wrote: 
> Hi, 
>  
> I am trying to write a page that creates some barcodes using the PEAR 
> Image_Barcode  module.  I am getting one barcode to write just fine 
> but it will not print out any more than one and will not print any 
> text on the page. 
>  
<----- SNIP --------> 
> 
> How do I get it so I can write HTML to the same page as my barcode?  I 
> am writing something very simple to play with this to start and only 
> one barcode is printing. 
>  
> <?php 
>         require("Image/Barcode.php"); 
>  
>         $bc = new Image_Barcode; 
>  
>         $bc->draw("BE1029", "Code39", "png"); 
>         $bc->draw("BE1020", "Code39", "png"); 
>         echo "hello" 
> ?> 
>  
<----- SNIP --------> 
>  
 
IMHO, because the class from PEAR actually putting out an image, it  
ultimately behaves as an image contenttype=image/png (or something like  
that). 
 
So in order to have 2 or more barcodes on your page, or text, you chould  
write another php (even html) that utilizes that your current barcode  
script. 
 
Example: 
create-barcode.php 
<?php 
          require("Image/Barcode.php"); 
          $bc = new Image_Barcode; 
          $bc->draw($_REQUEST['param1'], $_REQUEST['param2'], "png"); 
?> 
 
 
index.html 
<html> 
<!-- This is the first barcode --> 
<img src="create-barcode.php?param1=BE1029¶m2=Code39" /> 
<!-- This is the second barcode --> 
<img src="create-barcode.php?param1=BE1020¶m2=Code39" /> 
<!-- This is just text --> 
Hello 
</html> 
 
 
PLEASE NOTE: That the script that i put there is just an example of how  
it can be done, without the consideration of other security measures. 
 
Hendri Kurniawan
 
  
Navigation:
[Reply to this message] 
 |