-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error parsing image file exception on HTTP errors with cURL #253
Comments
Hmmm, does this issue looks like yours? #13 (just converting the url to base64 helped in this issue...) Question: why...? There is one other place where I could find the error message in the code, i.e. in Line 511 in f3c3295
What happens if you fill in your urls in this util script? (however I have no idea if code of the getImage() function in mpdf.php uses still the same logic). If it is still throwing the same issue, somewhere it missed the info to detect that you provided an image of type gif .
(The getImage() function is from about line 9347 to 9880 of |
@bcarroll2k3 Did you ever solve this? I have the exact same issue, also with WP thrown into the mix. Strange thing is that my code works on one particular shared hosting (and on my XAMPP on my local machine), but not on another, so I suspect some difference in GDlib version, maybe? Best regards. |
@cjsinnbeck in my case, I need to allow allow_url_fopen in php settings, because my image was not hosted on the same server. |
I was also getting the "Error parsing image file - image type not recognised, and not supported by GD imagecreate" error. In my case, it was caused by having an .htaccess password in place. |
I had a similar issue and I fixed it by adding streamwrappers to the $options of the \Mpdf\Mpdf() constructor: |
I have the same error message using mpdf8.0.x but the error seems to be a red-herring and it seems that the curl_exec is quietly failing in RemoteContentFetcher.php. As a temporary local edit, I've added the following code after the `
` .. this exposes that the underlying problem is a 404 Not Found. I've not worked out why the curl_error($ch) doesn't pick up the error (setting CURLOPT_FAILONERROR to true doesn't make it happen either). The mpdf problem seems to be around the fact that the curl isn't being allowed to read the image URL and I've not been able to work this out (putting in a simple curl test bed seems to result no solution), but as a mPDF work-around I have switched from using the img URL to the img filename, i.e. it would be good if the curl_exec error checking could be added in the Git code - I'll leave that to the code managers. Hope that helps |
Closing as stale. Will gladly reopen, if still applicable on current version which changed loading external resources a fair bit. |
I have an issue that is driving me insane, hopefully someone can shed some light. I have pages in a WordPress environment that generate PDFs. One is in a directory located at the root of the WP filesystem and is called directly (no WP URL rewrite). The other is served from WP and the code for PDF generation is located in functions.php for the theme.
The page located in the directory at the WP root works fine. The PDF generated from functions.php, which is nearly identical to the other page, constantly throws this error:
The html that's being rendered is identical. I'm using
WriteFixedPosHTML
to add an image to the document. The page that works defines this image as:The code in functions.php, which doesn't work, defines the image as:
I have to define it this way otherwise I get the error regardless. I have tried the following:
note the path hasn't changed
So, for the life of me I don't understand why
The php code used to generate pdfs from both pages is identical
I'm using mPDF v6 and PHP v5.4.45
Anyone? Thanks!
The text was updated successfully, but these errors were encountered: