bymayo / craft-pdf-transform

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

VolumeId given null #10

Closed Michael-Reich closed 2 years ago

Michael-Reich commented 3 years ago
  {% for item in entry.attachment %}
    {% if item.extension == 'pdf' %}
      {{ craft.pdfTransform.url(item) }}
    {% endif %}
  {% endfor %}

Generated this error:

TypeError
Argument 1 passed to craft\services\Volumes::getVolumeById() must be of the type int, null given, called in /Users/myname/Source/lions-club-erding/vendor/bymayo/pdf-transform/src/services/PdfTransformService.php on line 59
Michael-Reich commented 3 years ago

Solved it, the wrong volume was selected in the settings, it needs to be the same as the image. Is this maybe a bug?

bymayo commented 3 years ago

@Michael-Reich Where is your PDF file sitting, is it in the same volume?

laurabennett commented 3 years ago

I'm getting the same error. My PDF is in Images/Maps but I can't select a subfolder in settings.

adrianjean commented 2 years ago

I had the same error. I had configured my asset field to save in a sub-folder of a volume.

To solve it, I had to create a specific volume for PDFs then set the asset field to save PDF's in that volume, but not in a subfolder.

Make sure to:

bymayo commented 2 years ago

@laurabennett @adrianjean I think this error is mainly due to not selecting the volume to save the transformed images into. Just make sure this setting is added.