 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
jpbarber
Joined: 01 Feb 2008 Posts: 2 Location: UK
|
Posted: Fri Feb 01, 2008 1:24 am Post subject: Image_Barcode |
|
|
I'm not having much luck, creating barcodes on a HTML page
using:
<?php
require_once("/usr/local/lib/php/Image/Barcode/Code39.php");
$bc = new Image_Barcode;
$code = "123456789";
$bc->draw($code, "Code39", "jpg");
//$bc = new Image_Barcode_Code39('',2,4);
//$bc->draw('123456', 'jpg', false, 120);
?>
The last 2 lines give me nothing (hence commented out), the current code gives me I think the binary for the image:
ÿØÿàJFIFÿþ>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default qualityÿÛC $.' ",#(7),01444'9=82<.342ÿÛC 2!!222222222222222222222222222222222222222ÿÀ2 °
Etc:
Anyone got any ideas? or a better way of doing barcodes in php
Cheers
Jonathan |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1048
|
Posted: Fri Feb 01, 2008 10:36 am Post subject: |
|
|
Your require_once call is wrong. You'll run sooner or later into problems with PEAR packages if you don't adjust your include_path setting.
Apart from this issue, I don't see the problem with your code? Are you aware that you need an <img> tag in your HTML page that references the PHP script in the "src" attribute? |
|
| Back to top |
|
 |
jpbarber
Joined: 01 Feb 2008 Posts: 2 Location: UK
|
Posted: Fri Feb 01, 2008 12:07 pm Post subject: |
|
|
The path is set by our hosting company but we are having a dedicated server build. I don't understand what you mean so could you explain about the path then I can tell our hosting company so they can get it right on our new server?
Also please could you give me a quick example of the img tag
Many thanks
Jonatnan |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1048
|
Posted: Fri Feb 01, 2008 12:20 pm Post subject: |
|
|
| jpbarber wrote: | | The path is set by our hosting company but we are having a dedicated server build. I don't understand what you mean so could you explain about the path then I can tell our hosting company so they can get it right on our new server? |
Well, the include_path should include the PEAR directory, e.g.:
include_path = ".:/usr/share/pear/"
You can then shorten your require_once calls to e.g 'Image/Barcode.php' or 'HTML/QuickForm.php'.
| jpbarber wrote: | | Also please could you give me a quick example of the img tag |
<img src="your_barcode_script.php">, with your_barcode_script.php being the few lines of code that you've posted here. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|