php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12333 pdf_open_image_file fails for gif-pictures
Submitted: 2001-07-24 06:24 UTC Modified: 2001-07-24 06:36 UTC
From: christian at gaeking dot de Assigned:
Status: Closed Package: PDF related
PHP Version: 4.0.4pl1 OS: SuSE Linux 7.1
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: christian at gaeking dot de
New email:
PHP Version: OS:

 

 [2001-07-24 06:24 UTC] christian at gaeking dot de
Hello!
I have tested your pdf_open_image_file -function. 
It fails when I use gif-pictures that have a color-depth smaller than 16 bits per pixel. That means gifs with 16(4bpp) or 2 colors (b/w) will fail. With 256(16bpp) and 16,7M(24bpp) colors everything runs fine.
I used the following simple script for testing it:

<?PHP
           $fp = fopen("test.pdf", "w");
           $pdf = pdf_open($fp);
           $picname="test.gif";

           pdf_begin_page($pdf, 595, 842);

           $pim = pdf_open_image_file($pdf, "gif", $picname);
           pdf_place_image($pdf, $pim, 50, 100, 1);
           pdf_close_image($pdf, $pim);

           pdf_end_page($pdf);
           pdf_close($pdf);
           fclose($fp);
?>


The output of the script in case of errors was:

Warning: Could not open image in /usr/local/httpd/htdocs/regent/pdftest.php on line 8

Warning: Unable to find file identifier 0 in /usr/local/httpd/htdocs/regent/pdftest.php on line 9

Warning: Unable to find file identifier 0 in /usr/local/httpd/htdocs/regent/pdftest.php on line 10


My PHP-commandline is the following:
'./configure' '--prefix=/usr' '--bindir=/usr/bin' '--libdir=/usr/lib' '--with-exec-dir=%{libdir}/php/bin' '--with-mysql=/usr' '--with-gd=/usr' '--with-imap' '--with-imap-ssl=/usr' '--with-tiff-dir=/usr' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr/X11R6' '--with-pdflib=yes' '--with-ldap=yes' '--with-zlib=yes' '--with-xml' '--with-ttf' '--with-readline' '--with-ftp' '--with-ndbm' '--with-gdbm' '--with-mcrypt=/usr/lib/libmcrypt' '--with-mm' '--with-interbase' '--enable-versioning' '--enable-yp' '--enable-bcmath' '--enable-trans-sid' '--enable-inline-optimization' '--enable-track-vars' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-calendar' '--enable-sysvsem' '--enable-sysvshm' '--enable-shmop' '--enable-exif' '--enable-ftp' '--enable-memory-limit' '--enable-wddx' '--enable-filepro' '--enable-dbase' '--with-config-file-path=/etc/httpd' '--with-apxs=/usr/sbin/apxs' '--with-exec-dir=/usr/lib/apache/bin' 'i386-suse-linux-gnu'


If this is not a bug, a comment in the documentation could be very useful...

Greetings,

Christian G?king

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-24 06:36 UTC] rjs@php.net
The PDFlib documentation describes this behavior in Chapter 3.4.1.

Also you should check the result of pdf_open_image_file to avoid running into problems later.

As it is not possible to copy the complete content of the PDFlib Manual to the PHP Documentation it is recommended to use the original PDFlib manual when working with PDFlib.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC