I was using Imagick to generate thumbs in JPEG from pages of a PDF document. My local server for test never be able to do it, I always got a Ghostscript error. I was developing directly in my website host but now it stop working, it seems since 6.9.0 version of ImageMagick. As it is a shared hosting, I cannot do a downgrade and the administrators do not wish to do it (will be a donwngrade for everyone in the same server). It's a simple cheap hosting plan, I don't think they want to help me...
Also, as I look for answers, I see a lot of people complainig about this version, so it looks like a real bug.
So I started to look for an alternative inside PHP libraries or some API I can install to perform the job. Any suggestions?
This is the line that generates the error:
$Img->readImage($urlArq."[".$pag."]");
The error:
Fatal error: Uncaught exception 'ImagickException' with message 'PDFDelegateFailed `[ghostscript library] -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r150x150" -dFirstPage=1 -dLastPage=1 "-sOutputFile=/tmp/magick-316787_tM5qhaBA3E%d" "-f/tmp/magick-316787MBoQDwPMLvz" "-f/tmp/magick-31678SNvHB_Zdq8Xt"': -dname= must be followed by a valid token @ error/pdf.c/InvokePDFDelegate/263' in /home/sintrano/public_html/conteudo_apitaco_jpeg.php:23 Stack trace: #0 /home/sintrano/public_html/conteudo_apitaco_jpeg.php(23): Imagick->readimage('apitaco/edicao-...') #1 {main} thrown in /home/sintrano/public_html/conteudo_apitaco_jpeg.php on line 23
The version info:
versionNumber: 1680
versionString: ImageMagick 6.9.0-0 Q16 x86_64 2016-05-05 http://www.imagemagick.org
EDIT: I found this bug in my code: $pag cannot be zero, the first page is 1. But this was not generating the error before, don't know why, and I'm not sure if this was the problem.