relative pfad in Zend_Pdf_Image doesn´t work

71 views Asked by At

In my PdfController I want to print logos whose paths come from my database.

I tried like follows:

$pfad = ".". $logen->logo;
$image = Zend_Pdf_Image::imageWithPath($pfad);
$page->drawImage($image, $posX-30, $posY, $posX+30, $posY-30);

It doesn't work --> I get a time out.

Afterwards I wanted to know if I really get the right path:

$pfad = ".". $logen->logo;
$page->drawText($pfad, $posX, $posY +11,'UTF-8');

I get a path: ./images/logos/Berlin_1.png which is the right one.

If I try with the absolut path, it works:

$pfad = ".". $logen->logo;
$image = Zend_Pdf_Image::imageWithPath('./images/logos/Berlin_1.png');
$page->drawImage($image, $posX-30, $posY, $posX+30, $posY-30);

Where is the error, must be the same with the relative path?

1

There are 1 answers

0
pia-sophie On

This statement: $pfad = ".". $logen->logo; does not work correctly. Now I added the . to the paths in my database records and it works.

If somebody knows, why the statement isn't working it might be helpful.