hey
tcpdf is trying to write in /sites/all/libraries/tcpdf/cache
Fatal error: Uncaught exception 'ImagickException' with message 'Permission denied to: .../tcpdf/cache/mska_58d47ffff0132735a2ad9d61fc2294a4' in .../tcpdf/tcpdf.php:8083 Stack trace: #0 .../tcpdf/tcpdf.php(8083): Imagick->writeimage('...') #1 .../tcpdf/tcpdf.php(7545): TCPDF->ImagePngAlpha('/home/clients/g...', 51.8784916667, 17.9292126667, 22, 22, 6.35, 6.35, 'PNG', '', 'B', false, 300, '', '58d47ffff013273...') #2 [internal function]: TCPDF->Image('...', 51.8784916667, 17.9292126667, 6.35, 6.35, '', '', 'B', false, 300, '', false, false, Array, false, false, true) #3 /lib in .../tcpdf/tcpdf.php on line 8083
if it doesn't has permissions it returns this error.
this can't happen, permission to write on libraries and modules dir is a security risk. move cache out to /sites/default/files/tmp by default and provide a variable to change the directory.
Comments
Comment #1
hunziker commentedYour right, we need to change this.
I have never give the system the option to right to those directories and it works. I depends on the environment (Image Processing Library etc.).
Comment #2
sachbearbeiter commentedsub
Comment #3
patcon commentedRelevant:
http://tcpdf.git.sourceforge.net/git/gitweb.cgi?p=tcpdf/tcpdf;f=config/t...
Came across this and just wanted to share where the cache path and all that is set :)
Comment #4
castawaybcn commentedJust in case somebody can't get it to work (thanks to patcon for pointing out the solution):
1. Create a folder named tmp in your_drupal_site/sites/default/files
2. Make it writable by the server
3. Open the file your_drupal_site/sites/all/libraries/tcpdf/config/tcpdf_config.php and change this:
to this:
Of course you can use any name other than tmp for your folder.
Comment #5
jlab commentedI got this error after upgrading from Drupal 7.10 to Drupal 7.14
I copied the origional tcpdf and fpdi libraries I used on the Drupal 7.10 platform and got the above error...
When I install a new tcpdf library downloaded from the site the error goes away but none of the text is displayed in pdf only the images...
I have two sites on this platform both using views_pdf so the above solution will only solve one sites issues...
What would the best versions of tcpdf and fpdi to use in conjunction with this module?
Comment #6
ownage commentedUpgrading 7.12 to 7.14 (important Security Update) just caused my Views PDF View with images to render a similar error as well:
^ I get this for every node in the view
Line 7523 starts on $fp line:
----
On a side note, I would appreciate some help on this as this is on a client's production website who will be needing this view in the next couple weeks. I'll experiment with it but have never had to fix a library related issue in the past.
Comment #7
ownage commentedI was able to temporarily fix my specific issue by changing $diskcache to true on line 1213:
I still get the errors because the "/var/www/html/sites/all/libraries/tcpdf/cache" directory isn't writable for this script. Gotta contact my other webmaster to see how he set up the privileges. If I can suppress the errors, I will let you know here.
Comment #8
patcon commentedHi ownage,
Just a heads up, but that's a totally different error from the original, and so probably belongs in another new issue. I'd open a new one instead of posting here :)
Comment #9
glenn_jones commentedSame issue here
TCPDF ERROR: [Image] Unable to get image: /web/libraries/tcpdf//sites/default/files/styles/exhibitor_logo_140/adaptive-image/public/E-Boost%20logo.png
Can't we just change the directory?
Glenn
Comment #10
agnese.stelce commentedSame issue here. I think it's time to change cache directory. Print, email and and PDF versions module already do that - TCPDF allows to set custom cache directory with K_TCPDF_EXTERNAL_CONFIG setting. I will try to create a patch for that.
Comment #11
simon georges commentedThanks for trying to create a patch!
Comment #12
agnese.stelce commentedHello, Simon Georges!
I have created a patch for custom cache directory against 7.x - 1.x. I took idea from Printer, email and PDF versions (see here http://drupalcode.org/project/print.git/blob/refs/heads/7.x-1.x:/print_p...) Print module has separate setting for that, my patch at the moment just change the TCPDF cache directory so maybe that should be improved.
Comment #13
simon georges commentedHey, thanks!
Can somebody else review it, so we can confirm it works on several server configurations?
Comment #14
jibize commentedThe patch from #12 worked for me.
Thanks!
Comment #15
mareks commentedI can confirm that patch #12 applied to 7.x-1.x-dev (2013-Mar-09) solved the issue for me.
I had all sort of error messages (see below) before that and no images.
Comment #16
simon georges commentedOk, committed, thanks for the patch and the reviews!
Comment #17
killua99 commentedExist a patch to handle this issues and others. Please see #2032189: Multiple issue fixing in a single patch and review others issues patch.
This is RTBC, and ready to apply.
Comment #18
simon georges commentedThis patch has already been committed and pushed (just minutes before your comment, I suppose it's just damn bad luck on the timing on my part).
Comment #19
killua99 commentedUmmmm yeah I'll check again the full patch and handle the others fixings.
Comment #20
killua99 commented