Closed (fixed)
Project:
Printer, email and PDF versions
Version:
7.x-2.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Reporter:
Created:
20 Mar 2013 at 20:46 UTC
Updated:
17 Dec 2016 at 15:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jcnventuraDuplicate of #1926982: preg_replace pattern
Comment #2
ey commentedIt is not the duplicate of the mentioned issue, since the versions are different. This issue was about 7.x-1.2, I'm updating it to 7.x-1.x-dev and reopen the issue, since the problem still exists on 7.x-1.x branch.
Please port the fix to this branch as well, so that we can close this issue.
Thanks.
Comment #3
ey commentedI've created a patch which solves the issue. I've modified the regex to omit the itok.
Please review.
Comment #4
ey commentedComment #5
ice70 commentedHi,
I applied this patch and I can see the itok in the regex, but the itok querystring is still in the local image string and shows up as a missing image on the pdf.
Any guidance would be greatly appreciated.
Thank you
ice70
Comment #6
Johnny vd Laar commentedI've modified the patch such that it also works for 7.x-2.x. The pattern is a bit different because the itok part is optional.
Comment #7
Johnny vd Laar commentedComment #8
ey commented@Johnny vd Laar: This issue is for 7.x-1.x. Please check #1926982: preg_replace pattern for 7.x-2.x.
Comment #9
hwasem commentedIce70, I'm having the same problem after applying the patch in #2. Did you ever find a successful resolution for version 7.x-1.3?
Thanks,
Heidi
Comment #10
ice70 commentedHi Heidi,
sorry it has been a while since I did this and the project I think I did it for has long since moved to a different developer.
But, I *think* I got it working by adding:
$conf['image_allow_insecure_derivatives'] = TRUE;
to: settings.php
hope this helps :s
ice70
Comment #11
gaborpeter commentedThe path worked for me, but not for all cases.
The pattern says \w which not matching all itoks, as they may contain "-" character. (Check the function which generated the itok image_style_path_token + drupal_hmac_base64)
Thus the \w has to be replaced with [a-zA-Z0-9\-]
New patch attached.
Comment #12
kybermanThank you gaborpeter, this works well. But there is also underscore as possible character (I had "itok=m_eKzA05"), so "[a-zA-Z0-9\-_]" worked for me. Please, add "_" to your patch.
Comment #13
Anonymous (not verified) commentedUpdated patch as in comment #12 fixes the problem for me too. Thanks a lot gaborpeter and kyberman.
Comment #14
mschudders commentedComment #15
mschudders commentedI have updated the patch.
This is working for me on DomPDF with the latest DEV version of print.
What I needed to do was:
on this page: "/admin/config/user-interface/print/pdf".
check this checkbox Access images via local file access
Enabling this option will make the tool use local file access for image files. This option is not recommended to use in conjunction with modules like imagecache which generate the image after it's first accessed. However, it may be necessary in low-end hosting services where the web server is not allowed to open URLs and the user can't modify that configuration setting.
Otherwise it wouldn't work.
Comment #16
retiredpro commentedI'm on 7.x-2.x-dev and I applied the patch from #14 and checked the box for "Access images via local file access" as mentioned in #15. Fixed the issue for me. Thanks!
I was initially confused because the issue currently states that this is for 7.x-1.x-dev but the last few patches are targeting /includes/print.inc which 1.x does not have.
Comment #17
skdrupal88#14 works well, thanks Mschudders
Comment #19
jcnventuraThanks everyone!