PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Image_Barcode

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Images
View previous topic :: View next topic  
Author Message
jpbarber



Joined: 01 Feb 2008
Posts: 2
Location: UK

PostPosted: Fri Feb 01, 2008 1:24 am    Post subject: Image_Barcode Reply with quote

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
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1011

PostPosted: Fri Feb 01, 2008 10:36 am    Post subject: Reply with quote

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
View user's profile Send private message
jpbarber



Joined: 01 Feb 2008
Posts: 2
Location: UK

PostPosted: Fri Feb 01, 2008 12:07 pm    Post subject: Reply with quote

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
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1011

PostPosted: Fri Feb 01, 2008 12:20 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Images All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
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



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement

'Actiemonitor' online projectmanagement software