Topic on Extension talk:PdfHandler

Error creating thumbnail images

1
151.61.39.181 (talkcontribs)

Using mediawiki 1.30 and the extension for this version (PdfHandler-REL1_30-53d9884.tar.gz) I could not get thumbnail generation on the image page, where I got, instead of images, a text error like:

Error creating thumbnail: convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/504. convert: no images defined `/var/www/fountainpen.it/mediawiki/images/tmp/transform_7d1af7cbffc4.jpg' @ error/convert.c/ConvertImageCommand/32

looking at the debug I got the command used to create the thumbnail, they are called around line 188 of PdfHandler_body.php. a pipe between gs and convert. The problem is reported by convert, but it's caused by ghostscript, that, for the PDF files I was using, added to standard output (altough -q option is present) some line like:

  **** Warning: considering '0000000000 XXXXX n' as a free entry.
  **** Warning: considering '0000000000 XXXXX n' as a free entry.
  **** Warning: considering '0000000000 XXXXX n' as a free entry.
  **** Warning: considering '0000000000 XXXXX n' as a free entry.

those lines went on top of the jpeg image created over the pipe passed to convert, who failed conversion. Saving the image and processing it manually gave no error. I could solve the issue adding a line:

"-sstdout=/dev/null",

to the parameters passed to ghostscript inside PdfHandler_body.php, with a patch like this:

--- a/PdfHandler/PdfHandler_body.php    2018-04-30 23:14:14.000000000 +0200
+++ b/PdfHandler/PdfHandler_body.php    2018-11-01 13:02:12.744146598 +0100
@@ -195,6 +195,7 @@
            "-r{$wgPdfHandlerDpi}",
            "-dBATCH",
            "-dNOPAUSE",
+            "-sstdout=/dev/null",
            "-q",
            $srcPath
        );
Reply to "Error creating thumbnail images"