I fixed my problem with the loading times of my pictures, but now the images don't show up on my production system.
My images are in this directory: \public\images\logos
At my localhost environment the following paths are working I see the images in my pdf:
images/logos/*.*
/images/logos/*.*
./images/logos/*.*
If I use the same controller action on the production system, I get an error:
Message: Cannot create image resource. File not found.
I tried all varieties shown above.
How and where can I set something like an base path for the images and how do I have to name my relative paths in my database?
Additional information:
I try to get the images like this:
$pfad = $logen->logo ;
//$pfad=trim($pfad);
//$page->drawText($pfad, $posX, $posY +11,'UTF-8');
$image = Zend_Pdf_Image::imageWithPath($pfad); //Image mit präfix .)/ läuft auf localhost
$page->drawImage($image, $posX-30, $posY, $posX, $posY+30);
This works on localhost, but not on my production system, if I replace the path from the database with an absolute path like this:
$pfad='./images/fgld.jpg';
it works! If I put ./images/fgld.jpg
in my databasefield it doesn't work. So I think it must be an basic error with the pathnames.
EDIT 2: I tried like suggested:
$pfad = $logen->logo ; //".".
$baseUrl = $this->view->baseUrl() ;
$pfad=$baseUrl.$pfad;
I get the same error message like before. I tried to get the baseUrl which is:
/cheyenne/public
That seems to be ok, so I concatenated the rest of my path, and I get for the first record:
/cheyenne/public/images/logos/Berlin_1.png
Should be also ok, but it doesn't work. Additional I want to say that my project path on the productionsystem is in the first step under the root, should be also ok I think.
EDIT 3:
I tried the suggested application path, I get a wrong answer:
/mnt/weba/b3/45/5543245/htdocs/cheyenne/application/public
It should have been:
/mnt/weba/b3/45/5543245/htdocs/cheyenne/public
To get a result which works, I tried to add this path absolute like this:
$public_path='/mnt/weba/b3/45/5543245/htdocs/cheyenne/public';
$pfad = $public_path . $logen->logo ;
I get this one:
/mnt/weba/b3/45/5543245/htdocs/cheyenne/public/images/logos/Berlin_1.png
which should be right, but with the image statements I get the same error like before.
Thanks for the answers I learned some stuff.
I wrote a script and renamed all images in my directory the same way and now it works. It must be one different name something like that.