Issue producing Thumbnails from PDFs (Imagemagick and Ghostscript working fine?)


#1

Hi!!

I’m having trouble getting Omeka S to generate thumbnails for my PDF files. JPGs and PNGs seem to work just fine.
I created two sample items on the site so you get a sense https://ebp.newmedialab.cuny.edu/s/east-bay-punk-digital-archive/item

I took a quick look on the forum and saw that most folks said it’s got to do with either ImageMagick and/or Ghostscript, but our server’s administrator said both are installed and working correctly. On the server, he successfully ran imagemagick’s convert to make a pdf thumbnail with this argument:

< /home/ebp/public_html/files/original # convert -thumbnail x300 -background white -alpha remove 055e61b21d71fcba6d7fab2614c9ada78c65741c.pdf out.png >

That also seemed to work just fine. So Omeka S can save files to the server, can make thumbnails using imagemagick from those files (at least when they’re images), and can save thumbnails. Also, imagemagick on the server is built properly, with ghostscript installed, so that it can make thumbnails from PDFs. Given those facts, we’d expect that Omeka S could make a PDF thumbnail.

As for a reason for the problem, our server admin’s first guess is that perhaps the call to convert has a problematic argument or two, i.e. that it doesn’t look exactly like the line above, but without learning a lot more about how thumbnail generation works, that’s hard to test. If someone has any lead (or knows how the thumbnail creator works) that would be much appreciated!

Many thanks for your help.


#2

Your problem isn’t really quite the same as most others reporting this issue: you’re actually not getting thumbnails generated at all. The usual “Ghostscript problem” with PDF thumbnails is that thumbnails get generated, but just appear to be blank white images.

If you turn on error logging you should get some indication of what’s going wrong… typically if there’s no thumbnail generated there will be an error from ImageMagick in the log.


#3

Thank you for your help, John. I passed the message along to our admin and here’s his response.

" There’s no blank thumbnail.

The problem seems to be that Omeka’s not placing the file in /tmp when it expects it to be there.

The log shows:

2019-01-18T15:21:53+00:00 ERR (3): Command “/usr/local/bin/convert -density 150 ‘/tmp/omekaMhWxUh[0]’ -auto-orient -background white +repage -alpha remove -thumbnail ‘800x800>’ ‘/tmp/omekaSU9tA1.jpg’” failed with status code 1.

But if I manually move a PDF to /tmp/omekaMhWxUh and run that command from a shell, the JPG is created.

Of course, Omeka is able to write to /tmp, which we know because other uploads work and generate thumbnails, so I’m confused why PDFs would be different."


#4

Ugh, still no luck with this. We are really struggling to figure out what the issue might be.


#5

Setting the following in local.config.php may get you more useful logging on this issue…

    'cli' => [
        'execute_strategy' => 'proc_open',
    ],

(just add execute_strategy in if you already have a cli section in the file)

What we’re looking for is to get the error message(s) ImageMagick is printing logged, something that the proc_open strategy is better at doing.


#6

Also, what version of Ghostscript is being used? There do appear to be some issues with recent versions of Ghostscript that can cause mysterious errors when trying to thumbnail PDFs.


#7

Thank you, John! The issue seems to have been fixed. I can ask our people what the problem was if it could be of help for the development team to know that.


#8

Sure, if it’s no trouble… always want to hear what the fix was. At a minimum it’s something that other people could refer to if they’re having a same/similar issue.