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
Comment #1
tchurch commentedI agree. Even with allow_url_fopen turned on, it still doesn't work for me.
Comment #2
tchurch commentedIn 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.
Comment #3
marrch_caat commentedComment #4
jcnventuramarrch_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