Hi there,

firstofall great module. But we had to identify a major bug within.

The print module (especially PDF generation) does not seem to preprocess ImageCache images on its own. Images are only being embedded correctly, if a page with this image (in the selected format) has been visited before. Else they are BROKEN!

So if an image does not yet exists in a specific format (for example after you've cleared the formats ImageCache cache) and you don't visit a page generating this image before, the image will be broken in PDF Generation.

Solution in my eyes: Call an imagecache function before that ensures that the image is existing in the selected format or else generate it.

Environment:
Printer, e-mail and PDF versions 6.x-1.12
PDF engine: tcpdf (tcpdf_5_9_078)

Error Example:
TCPDF ERROR: [Image] Unable to get image: file:///home/www/XXXX/html/XXXXX/sites/default/files/imagecache/Preview/XXXXXXX/XXXXX/XXXXXX.png
(The image really doesn't exist(!! proofed !!) until it is being generated!)

Comments

Anybody’s picture

jcnventura’s picture

I am not sure how this can be fixed correctly..

I would prefer not to treat imagecache images as a special case and have the module generate them.. The right solution would be to have the web server request the web page from itself, so that those files are generated.. However, the objective of accessing the images internally is that because of security lockdowns several web servers have outgoing access disabled. So we're in a catch-22.

What I will probably do is to add a configuration parameter to disable direct-to-file in PDF, and allow it to go through the server.

jcnventura’s picture

Status: Active » Fixed

I've committed to git a setting to make local filesystem access configurable.. Use of imagecache will require this setting to be off (i.e. access via URLs).

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anybody’s picture

Version: 6.x-1.12 » 7.x-1.2
Status: Closed (fixed) » Needs work

Hi,

firstofall thanks a lot for your quick reaction.
In the current D7 Version the checkbox you mentioned exists, but doesn't seem to influence the behaviour.

No matter if it is enabled or disabled I receive the following error, if I try to create a PDF with tcpdf that contains an imagecache picture:

TCPDF ERROR: [Image] Unable to get image: file:///home/XXdummy-placeholderXX/files/arl/styles/user_picture-width_100px-height_100percent/private/pictures/picture-251-1345740162.jpg?itok=gAKsHdKN

Any idea where this problem comes from? I'd like to help you to fix it asap.

jcnventura’s picture

Status: Needs work » Postponed (maintainer needs more info)

Can you try the latest dev? I think this might have been fixed already (by #1926982: preg_replace pattern).

Anybody’s picture

Version: 7.x-1.2 » 7.x-2.x-dev

No I'm sorry it doesn't. But now we can upgrade the issue to the latest dev ;)

The problem is the same:
"Image not found
file:///home/www-XXXXX/files/arl/styles/user_picture-width_100px-height_100percent/private/pictures/picture-251-1345740162.jpg?itok=gAKsHdKN"

I've just checked it, the file path (starting "/home/www...") above exists in the file system and the file exists too. Other images like the page logo exists.
The file name above is a user picture (avatar) of the node creator... any ideas?

jcnventura’s picture

If it starts with file, it means you have local file access turned on.. You can't use that and image cache at the same time.

Anybody’s picture

Negative. Locale file access is OFF in the print (pdf) settings, but that does not change anything. And that is the point in my eyes.

jcnventura’s picture

Is it a private file system image then? That could be a problem. Imagecache generates the images on first access, but if the first access is from PDF, it will fail. I'm not sending the user session cookie which needs to be used for the server to access itself.

Anybody’s picture

Status: Postponed (maintainer needs more info) » Active

Yes it is a private file system, that could be a reason.

spgd01’s picture

Issue summary: View changes

This is still an issue. I am not using a private file system. However, I am using Picture Module. So if I do not resize each and every page so that the picture module creates the Image Cache image for every size then I get the Image not found or Image size not found message.