Page 1 of 1

magickException: Postscript delegate failed IIS

Posted: 2014-01-06T20:56:09-07:00
by Namari
Hey Guys!

I'm trying to use theses lines to convert a pdf to a jpg but I got an error

Code: Select all

$img = new imagick($url.'[0]');
$im->setImageColorspace(255);
$im->setCompressionQuality(95);
$im->setImageFormat('jpeg');
I have install imagick 3.1.0RC2 with the soft ImageMagick 6.7.7-10 2012-06-27 Q16 (x86). I also have a x86 PHP 5.4.22 non thread and I'm using IIS 8 on a windows server 2012. The php_imagick.dll is for 5.14 nts so it should work. The ghostscript version is gs9.10, I installed 32 and 64 bits. it is working perfectly with the msdos command line but no with PHP.

and then I got this error when I create the object.

Code: Select all

ImagickException: Postscript delegate failed `D:\inetpub\website\sites\default\files\image_2.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/677 in Imagick->__construct()
is it an environment variables problem ? I've got the imagick folder and the bin folder of ghostscript as windows environment variable.
Any ideas ?

Cheers

Re: magickException: Postscript delegate failed IIS

Posted: 2014-01-06T21:08:12-07:00
by snibgo
It can't find the PDF in a relative path, but relative to where? You might try an absolute path.

Re: magickException: Postscript delegate failed IIS

Posted: 2014-01-06T21:27:44-07:00
by Namari
the path I gave him was D:\inetpub\website\sites\default\files\image_2.pdf I also tried the url but no success.
for the url http://mywebsite/sites/default/files/image_2.pdf it gives me :

Code: Select all

ImagickException: Unable to read the file: http://mywebsite/sites/default/files/image_2.pdf in Imagick->__construct()

Re: magickException: Postscript delegate failed IIS

Posted: 2014-01-08T15:44:45-07:00
by Namari
anyone ?

Re: magickException: Postscript delegate failed IIS

Posted: 2014-01-08T15:55:44-07:00
by fmw42
Try a file of another format, such as gif, jpg, png. Does that work? If so, the perhaps it is not finding Ghostscript or the directory is password protected? Or try getting an image from some other more common web site, such as google or yahoo. Does that work?

Re: magickException: Postscript delegate failed IIS

Posted: 2014-01-08T16:13:30-07:00
by Namari
It seems that it's not finding ghostscript :(
It is working if I'm using a shell_exec(gswin64 ...) but that's not what I'm looking for.

Re: magickException: Postscript delegate failed IIS

Posted: 2014-01-08T19:59:01-07:00
by fmw42
check phpinfo.php

You may have to configure PHP so that it can find ghostscript.

Re: magickException: Postscript delegate failed IIS

Posted: 2014-01-08T21:56:42-07:00
by Namari
I'm not sure there is something I can do in php.ini.

Re: magickException: Postscript delegate failed IIS

Posted: 2014-01-09T09:20:00-07:00
by snibgo
Have you tried putting the full path to GS in delegates.xml?

Re: magickException: Postscript delegate failed IIS

Posted: 2014-01-12T16:54:32-07:00
by Namari
I changed the code below by the other one but nothing :(

Code: Select all

<delegate decode="eps" encode="pdf" mode="bi" command=""@PSDelegate@" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -sDEVICE=pdfwrite "-sOutputFile=%o" -- "%i""/>

Code: Select all

  <delegate decode="eps" encode="pdf" mode="bi" command='"C:\Program Files (x86)\gs\gs9.10\bin\gswin32.exe" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -sDEVICE=pdfwrite "-sOutputFile=%o" -- "%i"'/>

Re: magickException: Postscript delegate failed IIS

Posted: 2014-01-12T17:37:33-07:00
by Namari
I finally found out what was the problem !
The problem is the temporary folder of windows (c:\windows\temp) has to be read and write for the user IUSR or IIS_IUSRS (depending of your ISS version) Thank you guys for your help

Re: magickException: Postscript delegate failed IIS

Posted: 2014-04-18T01:22:25-07:00
by ncrause
I had precisely the same issues describe in this thread, and Namari's final solution (changing file permissions on C:\Windows\Temp) resolved the problem. Much appreciated!