Imagemagick error when trying to generate pdf thumbnails

Hi there,
I have a production server for one year already based on an import from omeka Classic that already had thumbnails for pdf. Now I need to add other pdfs but I get no thumbnails.

Can you check out this error I got from application.log:

2019-01-11T09:08:40+00:00 ERR (3): Command "/usr/bin/convert -density 150 '/tmp/omekaCCTAuI[0]' -auto-orient -background white +repage -alpha remove -thumbnail '800x800>' '/tmp/omekajXlRwH.jpg'" failed with status code 1.

Is there a typo in the command? The “[0]” is it ok to be in the input filename?

The [0] basically means “first page,” and it’s supposed to be there.

Does it just say status code 1 or is there any more information, like the output from imagemagick?

No. There’s no output from imagemagick.

How can I debug this?

I found the solution.

It was an imagemagick policy that needed to be turn on.
First I run manually the same convert command and got this error: “convert: not authorized `test.pdf’ @ error/constitute.c/ReadImage/412.” Then I searched google and got this: https://stackoverflow.com/questions/42928765/convertnot-authorized-aaaa-error-constitute-c-readimage-453

So, the solution is to modify “/etc/ImageMagick-6/policy.xml” and change

<policy domain="coder" rights="none" pattern="PDF" />

to

<policy domain="coder" rights="read|write" pattern="PDF" />

One thing to keep in mind is that distributions set those default policies for a reason… in this case probably because of a recent security issue with Ghostscript (which is used by ImageMagick for producing images from PDFs).

Definitely make sure you have an updated or patched version of Ghostscript if you’re changing your distro’s default settings like this.