bymayo / craft-pdf-transform

Transform a PDF page to an image (JPEG, PNG)
MIT License
12 stars 8 forks source link

upload error with asset field #23

Open samlising opened 1 year ago

samlising commented 1 year ago

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 commented 1 year ago

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

green17 commented 12 months ago

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.