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
Comment #1
AnybodyBy the way, here a hint for a possible solution:
http://stackoverflow.com/questions/2965490/generate-image-with-drupal-im...
Comment #2
jcnventura CreditAttribution: jcnventura commentedI 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.
Comment #3
jcnventura CreditAttribution: jcnventura commentedI'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).
Comment #5
AnybodyHi,
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.
Comment #6
jcnventura CreditAttribution: jcnventura commentedCan you try the latest dev? I think this might have been fixed already (by #1926982: preg_replace pattern).
Comment #7
AnybodyNo 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?
Comment #8
jcnventura CreditAttribution: jcnventura commentedIf 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.
Comment #9
AnybodyNegative. Locale file access is OFF in the print (pdf) settings, but that does not change anything. And that is the point in my eyes.
Comment #10
jcnventura CreditAttribution: jcnventura commentedIs 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.
Comment #11
AnybodyYes it is a private file system, that could be a reason.
Comment #12
spgd01 CreditAttribution: spgd01 commentedThis 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.