Bug #12021: Problem with the data parameter in pdf_open_image()
| From: | fred at surleau dot com | Date: | Tue, 10 Jul 2001 16:50:56 +0000 |
| Subject: | Bug #12021: Problem with the data parameter in pdf_open_image() | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-59575@lists.php.net to get a copy of this message | ||
From: fred@surleau.com
Operating system: Win NT 4.0
PHP version: 4.0.6
PHP Bug Type: FDF related
Bug description: Problem with the data parameter in pdf_open_image()
Hi,
I use PDFLIB version 4.0.1 and PHP 4.0.6.
<?
$file = "image.jpg";
$len=filesize($file);
$fp = fopen($file, "rb");
echo $fp;
$data = fread($fp, $len);
fclose($fp);
$pdf=pdf_new();
pdf_open_file($pdf, "test.pdf");
pdf_begin_page($pdf, 595, 842);
// With pdf_open_image_file() it works !
// $pim = pdf_open_image_file($pdf, "jpeg", $file");
$pim = pdf_open_image($pdf, "jpeg", "memory", $data, $len, 300, 100, 3, 8,
"" );
PDF_place_image($pdf, $pim, 100, 500, 1);
PDF_close_image($pdf, $pim);
pdf_end_page($pdf);
pdf_close($pdf);
?>
The script works with no errors, and the PDF file is created.
With pdf_open_image_file() the Jpeg file is correctly mixed in the PDF
file
With pdf_open_image(), at the place in the PDF file where I should find the
Jpeg data, there is garbage starting with "C:\inetpub\wwwroot" !
I need to use pdf_open_image() instead of pdf_open_image_file() because the
image I want to use is not a file, it's created with the gd library, and
the function pdf_open_memory_image() is not available in PHP 4.0.6 binaries
for Win32.
Regards.
Fred.
--
Edit bug report at: http://bugs.php.net/?id=12021&edit=1