Mantis - Quercus
Viewing Issue Advanced Details
4642 minor always 06-27-11 10:37 07-06-11 14:23
rickHigh  
 
normal  
feedback  
open  
none    
none  
0004642: Problem displaying images with PDFLib
I would expect this to work.


$logo = $pdf.load_image("auto", "images/caucho-logo.png", "");
if ($logo == -1)
  throw new Exception("Error: " + $pdf.get_errmsg());

$pdf.fit_image($logo, 50.0, 500.0, "");

$pdf.close_image($logo);

It does not work and it does not display anything. If it could not find the image, the expectation is that it would return -1 as per PDFLib documents.

I also tried this:


$logo = $pdf.load_image("auto", "random_text_that_is_not_a_real_image.jpg", "");
if ($logo == -1)
  throw new Exception("Error: " + $pdf.get_errmsg());

$pdf.fit_image($logo, 50.0, 500.0, "");

$pdf.close_image($logo);


I would expect the above to throw an exception. It does not.

Notes
(0005336)
rickHigh   
06-27-11 11:03   
Scott looked into the code and it is not supporting PNG at this time.

I converted the PNG to a JPG and retried. It did not work.

$logo = $pdf.load_image("auto", "images/caucho-logo.jpg", "");
if ($logo == -1)
  throw new Exception("Error: " + $pdf.get_errmsg());

$pdf.fit_image($logo, 50.0, 500.0, "");

$pdf.close_image($logo);


Then I tried an absolute path and it did not work.



$logo = $pdf.load_image("auto", "/Users/rick/tools/resin/resin-pro-4.0.19.1/doc/admin/images/caucho-logo.jpg", "");
if ($logo == -1)
  throw new Exception("Error: " + $pdf.get_errmsg());

$pdf.fit_image($logo, 50.0, 500.0, "");

$pdf.close_image($logo);
(0005344)
domdorn   
07-04-11 09:39   
you can't use the dot for accessing an object in PHP.

try

$logo = $pdf->load_image(...)

the dot is for string concatenation.
(0005357)
domdorn   
07-06-11 10:42   
please update if the issue is solved.
if not, please send me the full code or link to the gist so I can take a look
(0005361)
rickHigh   
07-06-11 14:23   
The code is in the admin tool.

/home/svn/svnroot/resin/trunk/php/admin

post-mortem-pdf.php