In the theme_print_pdf_tcpdf_header() function in print_pdf.pages.inc there is a call to getimagesize() that receives a link to the logo image as an argument. But when allow_url_fopen in PHP.ini is off, the call fails and PDF producing fails in turn. It's not good. At least the requirement to have allow_url_fopen turned on should be documented, but it's no good too, since it'd prevent the modulefrom running on most shared hosting servers.
Much better solution is to check if the link is local (that'd be true in 99.99% cases) and convert it to a file path:

...
  if ($logo_ret) {
    $logo = trim($matches[1], '\'"');

    if (strpos($logo, $base_root) === 0){
      $logo = substr($logo, strlen($base_root)+1);
    }
...

And, the last, probably there still should be some kind of try..catch wrapping around getimagesize() call - just for the case when it's the remaining 0.01% and $logo url is somehow not local.

Comments

tchurch’s picture

I agree. Even with allow_url_fopen turned on, it still doesn't work for me.

tchurch’s picture

In fact I've seen several issues for this module which mention this error with loading the logo (using this function) and the issues are always closed.

I would think that a lot of people would want to see this fixed. Not everyone has control over the servers they use.

marrch_caat’s picture

Priority: Normal » Critical
jcnventura’s picture

Status: Active » Fixed

marrch_caat: Thanks for bringing this to my attention, I have now fixed this in CVS. It will be in the next releases.

tchurch: There are tons of Apache / PHP / OS / firewall configurations which I can't possibly test them all. Unless someone provides a detailed and reproducible description of the problem like marrch_caat did here, it is simply impossible for me to find out where the problem is, so that I can fix it and test it. In order to keep track of the ones which I can possibly fix, I close down the issues where the user hasn't been able to provide me with enough information.

João

Status: Fixed » Closed (fixed)

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