Img to a stream
| From: | Todd Cary | Date: | Wed, 11 Jun 2003 01:05:36 +0000 |
| Subject: | Img to a stream | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-150999@lists.php.net to get a copy of this message | ||
Forgive me if my question is confuing, but I am confused so asking the question properly is difficult.
Currently, I have a PHP application that produces barcodes in HTML. It uses the following line:
// Create the Barcode
if ($obj) {
if ($obj->DrawObject($xres)) {
echo "<td><img src='./image.php?code=" . $barcode . "&style=" . $style . "&type=" . $type .
"&width=" . $width . "&height=" . $height . "&xres=" . $xres . "&font=" . $font . "'></td>";
} else {
echo "<td><font color='#FF0000'>" . ($obj->GetError()) . "</font></td>";
}
} else {
echo "<td><font color='#FF0000'>Obj is false; Barcode = " . $barcode . "</font></td>";
}
where image.php is creating the image. Now I need to do the same thing except for a PDF file.. In the following code, I am reading in a JPEG file, but I want to avoid the use of a file, and want to use a "data stream" instead.
$fn = "dsc_5525.jpg";
$fh = fopen($fn, "r");
$data = fread($fh, filesize($fn));
fclose($fh);
$image = $pdf->jfif_embed($data);
$pdf->image_place($image, 50, 0, $firstpage);
In other words, I want to put the barcode date into $data and I am not sure how to do this. Any help is greatly appreciated.
Todd
--