FPDF error: Missing or incorrect image file:

3,910 views
Skip to first unread message

franc...@gmail.com

unread,
Apr 29, 2014, 6:59:55 AM4/29/14
to caucho-...@googlegroups.com
Hi all,
i've deployed quercus 4.0.37 on glassfish 3 and i've uploaded my application.
It works fine, but when i use FPDF to generate a report in PDF (in the header of each pdf page, i've a logo), i get "missing or incorrect image file". Now, i've tried both absolute and relative path to the image, but no luck. It seems a problem with php configuration. On internet I've found that allow_url_fopen must be set to ON. Where do I set this? i've tried:
1) to add php.ini on my WEB-INF/ folder, width "allow_url_fopen = ON", and, inside WEB-INF/web.xml i've added "<init-param><param-name>ini-file</param-name><param-value>WEB-INF/php.ini</param-value></init-param>", restarted glassfish
2) create a .htaccess file in my application root folder, with allow ulr fopen to on

but with no results.

Any suggestions?
Thanks.

Nam Nguyen

unread,
Apr 29, 2014, 12:54:16 PM4/29/14
to caucho-...@googlegroups.com
Can you send a sample script? It's likely a Quercus bug somewhere.

-- Nam

>
> Any suggestions?
> Thanks.
>
>

franc...@gmail.com

unread,
Apr 30, 2014, 3:57:45 AM4/30/14
to caucho-...@googlegroups.com, n...@caucho.com
My class:

class PDF extends FPDF
{
var $Title;

function Header(){
// Logo
$this->Image('images/logo.jpg',0,0, 25, 21.5);

$this->SetFont('Arial','B',8);
$this->SetTextColor(140,140,140);
$this->SetDrawColor(180,180,180);//(45,57,141);

// Title
$this->Cell(20,8,"",0,0);
$this->Cell(150,8,@date("Y,m/d") . " - " . $this->Title,1,0,'C');
$this->Ln(20);
}
...
...
}

My script:

$pdf = new PDF();
$pdf->AddPage();

When I call AddPage(), the function "Header()" is automatically called.

With glassfish / quercus I get this error: "FPDF error: Missing or incorrect image file:". So i've tried with apache web server and it works fine...

The result of phpinfo():
QUERCUS
PHP Version => 5.4.0
System => Linux 2.6.32-31-server amd64
Build Date => 20130905T080412
Configure Command => n/a
Server API => CGI
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /home/dimarklab/glassfish3/glassfish/domains/domain1/applications/dReport/WEB-INF/php.ini
PHP API => 20031224
PHP Extension => 20041030
Debug Build => no
Thread Safety => enabled
Registered PHP Streams => php, file, http, https

I've added this:


<init-param>
<param-name>ini-file</param-name>
<param-value>WEB-INF/php.ini</param-value>
</init-param>

to WEB-INF/web.xml, as shown in the phpinfo() result, and in php.ini I set allow_url_fopen to ON, but it doesn't work!

Nam Nguyen

unread,
May 1, 2014, 3:53:24 PM5/1/14
to franc...@gmail.com, caucho-...@googlegroups.com
Thanks for the test case. I'll check it out.

-- Nam

daniel...@hotmail.com

unread,
Jun 10, 2014, 1:07:15 AM6/10/14
to caucho-...@googlegroups.com, franc...@gmail.com

I'm trying to solve the same thing, unsure if this link will help you? If it does please let me know! http://stackoverflow.com/questions/3177716/fpdf-error-missing-or-incorrect-image-file

franc...@gmail.com

unread,
Jun 10, 2014, 3:19:09 AM6/10/14
to caucho-...@googlegroups.com, franc...@gmail.com, daniel...@hotmail.com
Thanks, but it was my first try, and it didn't work. This isn't the rigth solution for my case.
Reply all
Reply to author
Forward
0 new messages