Re: Image/Barcode
| From: | Richard Quadling | Date: | Tue, 05 Apr 2011 10:30:30 +0000 |
| Subject: | Re: Image/Barcode | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-31057@lists.php.net to get a copy of this message | ||
On 4 April 2011 16:49, Alejandro Crosa <alecros@ymail.com> wrote:
> Hi
> I need resolve one problem...
> I am using the Image Barcode pear package and this is working very well but I can see the
> result only by executing the php script and I can not see it in the browser by using the
> file_put_contents() function for example.
>
> I hope to be clear.
>
> Thanks
>
> Regards
>
> Alejandro
>
>
>
>
<html>
<head>
<title>Show barcode</title>
</head>
<body>
<img src="generate_barcode.php" />
</body>
</html>
I suspect you are currently calling generate_barcode.php and seeing a
barcode image.
If you want to see it in a HTML page, then you have to use an img tag
(see code above).
If you also want to save the image on the server (for caching
purposes), then use
imagepng($bc->draw($data, $type, 'png', false),
'/images/barcode.png'); // Save the image to disk in
/images/barcode.png
$bc->draw($data, $type, 'png'); // Outputs the image to the browser -
you MAY need to issue appropriate content-type headers.
--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY