Skip to content

upload error with asset field #23

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

Open
samlising opened this issue Jul 20, 2023 · 3 comments
Open

upload error with asset field #23

samlising opened this issue Jul 20, 2023 · 3 comments

Comments

@samlising
Copy link

When using an asset field to upload a PDF and clicking on "upload asset" (selecting asset to upload in a dialog box), an error will occur during the transform of the pdf file. It only occurs when uploading though the dialog box. However, If I drag a PDF file into the field it uploads and transforms the image properly.

Here is the error from the weblog:

2023-07-20 07:54:48 [web.ERROR] [ImagickException] improper image header `/home/forge/dev.santiccioli.com/storage/runtime/temp/2802430.png' @ error/png.c/ReadPNGImage/4092 {"trace":["#0 /home/forge/dev.santiccioli.com/vendor/spatie/pdf-to-image/src/Pdf.php(42): Imagick->pingImage()","#1 /home/forge/dev.santiccioli.com/vendor/bymayo/pdf-transform/src/services/PdfTransformService.php(117): Spatie\\PdfToImage\\Pdf->__construct()"

I have worked around this problem by including the previous transformPdfsOnUpload functionality that was available in version for craft 3. When I turn off transformPdfsOnUpload, there is no error when clicking on "upload asset" button.

@samlising
Copy link
Author

is it possible to add transformPdfsOnUpload setting back into the craft 4 version of the plugin.

@green17
Copy link

green17 commented Sep 25, 2023

We have encountered this issue also. Uploading the PDF triggers the error though, if uploaded separately, the file can be chosen and there is no error.

@jas8522
Copy link

jas8522 commented May 15, 2025

In case someone else comes across this for this edge-case reason: 'improper image header' can also occur if the server is incapable of reaching itself. Ex: if you've blocked access to the world excluding certain IPs, but the server IP is not in that exclusion list (ie: it's not allowed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants