Error Message:
Code: Select all
Fatal error: Uncaught exception 'ImagickException' with message 'Postscript delegate failed `d:/web/content/document/publication.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/682' in D:\web\content\library\pdfThumb.php:30 Stack trace: #0 D:\web\content\library\pdfThumb.php(30): Imagick->__construct('d:\web\co...') #1 D:\web\content\library\pdfThumb.php(15): pdfThumbGenerate('d:\web\co...', 'd:\web\co...', 0, 170, 0) #2 D:\web\content\index.php(173): pdfThumb(Array, 170, 0) #3 {main} thrown in D:\web\content\library\pdfThumb.php on line 30
When using ImageMagick through PHP it seems as if it simply can't find and/or run the GhostScript executable. I can actually uninstall GhostScript and receive the exact same error from PHP, which really illustrates the fact that it just can't find/execute GS.
My instincts tell me that this is a permissions issue with being able to run the GhostScript executable through PHP Imagick, but I am not sure what else to try... I'm anxiously awaiting your analysis and suggestions.
Things I Have Tried:
- I am able to execute the conversion from a command-line which converts the PDF to GIF with no problems.
- I am able to use ImageMagick through PHP to convert and resize other input formats with no problems.
- I have verified that ImageMagick and GhostScript binary paths are both defined in the PATH environment variable.
- I have verified that Imagick shows up healthy on the phpinfo() page and it does.
- I have examined the path in a PHP script using getenv('PATH') to be sure GS and Imagick paths are there, and they are.
- I have checked the delegates with "convert -list delegate" command and the correct full path to GS is present.
- I have tried using both relative and absolute file system paths for the input/output files. This did not fix it.
- I have reinstalled ImageMagick and GhostScript in different orders, GS before Imagick and vice-versa. This did not fix it.
- I have adjusted permissions to provide IUSR with read access to the GS program files folder. This did not fix it.
- I have adjusted permissions to provide IUSR with full permissions to c:\windows\temp folder. This did not fix it.
- I have changed the website's application pool to run as administrator. This did not fix it.
Convert Command-Line Success:
Code: Select all
convert -resize 170 d:/web/content/document/publication.pdf[0] d:/web/content/document/publication.gif
Code: Select all
C:\Program Files (x86)\gs\gs9.10\bin;C:\Program Files (x86)\ImageMagick-6.8.7-Q16;C:\Program Files (x86)\PHP\v5.4;C:\Windows\system32\inetsrv;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;
Code: Select all
$pdfFile = "d:/web/content/document/publication.pdf";
$pdfThumb = "d:/web/content/document/publication.gif";
$data = new imagick($pdfFile."[0]");
$data->setImageFormat("gif");
$data->resizeImage(170, 220, imagick::FILTER_LANCZOS, 1);
$data->writeImage($pdfThumb);
$data->clear();
$data->destroy();
Code: Select all
> convert -list configure
Path: [built-in]
Name Value
-------------------------------------------------------------------------------
FEATURES OpenMP
NAME ImageMagick
QuantumDepth 16
Path: C:\Program Files (x86)\ImageMagick-6.8.7-Q16\configure.xml
Name Value
-------------------------------------------------------------------------------
CC vs10
COPYRIGHT Copyright (C) 1999-2013 ImageMagick Studio LLC
DELEGATES bzlib freetype jpeg jp2 lcms png tiff x11 xml wmf zlib
FEATURES OpenMP
HOST Windows
LIB_VERSION 0x687
LIB_VERSION_NUMBER 6,8,7,0
NAME ImageMagick
RELEASE_DATE 2013-10-01
VERSION 6.8.7
WEBSITE http://www.imagemagick.org
Code: Select all
> convert -list delegate
Path: C:\Program Files (x86)\ImageMagick-6.8.7-Q16\delegates.xml
Delegate Command
-------------------------------------------------------------------------------
cdr => "uniconvertor" "%i" "%o.svg"; rename "%o.svg" "%o"
cgm => "uniconvertor" "%i" "%o.svg"; rename "%o.svg" "%o"
dot => "dot -Tps "%i" -o "%o"
dvi => "dvips -q -o "%o" "%i"
dxf => "uniconvertor" "%i" "%o.svg"; rename "%o.svg" "%o"
emf => "emfplus.exe -format png -dpi %x\x%y "%i" "%o"
eps<=>ps "C:/Program Files (x86)/gs/gs9.10/bin/gswin32c.exe" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 -sDEVICE=pswrite "-sOutputFile=%o" -- "%i"
eps<=>pdf "C:/Program Files (x86)/gs/gs9.10/bin/gswin32c.exe" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -sDEVICE=pdfwrite "-sOutputFile=%o" -- "%i"
fig => "uniconvertor" "%i" "%o.svg"; rename "%o.svg" "%o"
gplt => "/bin/echo "set size 1.25,0.62 set terminal postscript portrait color solid; set output "%o"; load "%i"" > "%u";gnuplot %u"
hpg => "hp2xx -q -m eps -f "%o" "%i"
hpgl => "hp2xx -q -m eps -f "%o" "%i"
htm => "html2ps -U -o "%o" "%i"
html => "html2ps -U -o "%o" "%i"
ilbm => "ilbmtoppm "%i" > "%o"
jxr => "rename "%i" "%i.jxr"; "@JXRDecodeDelegate@" -i "%i.jxr" -o "%o.pnm"; rename "%i.jxr" "%i"; rename "%o.pnm" "%o"
man => "groff -man -Tps "%i" > "%o"
mpeg:decode => "ffmpeg.exe" -v -1 -i "%i" -vframes %S -vcodec pam -an -f rawvideo -y "%u.pam"
pdf<=>eps "C:/Program Files (x86)/gs/gs9.10/bin/gswin32c.exe" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -sDEVICE=epswrite "-sOutputFile=%o" -- "%i"
pdf<=>ps "C:/Program Files (x86)/gs/gs9.10/bin/gswin32c.exe" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 -sDEVICE=pswrite "-sOutputFile=%o" -- "%i"
pgp => "pgpv -fq "%i"
png<= show "cmd.exe /C start "%m" file:///"%i."
png<= win "cmd.exe /C start "%m" file:///"%i."
png<= launch "cmd.exe /C start "%m" file:///"%i."
pnm<= jxr "rename "%i" "%i.pnm"; "@JXREncodeDelegate@" -i "%i.pnm" -o "%o.jxr"; rename "%i.pnm" "%i"; rename "%o.jxr" "%o"
pnm<= wdp "rename "%i" "%i.pnm"; "@JXREncodeDelegate@" -i "%i.pnm" -o "%o.jxr"; rename "%i.pnm" "%i"; rename "%o.jxr" "%o"
pnm<= ilbm "ppmtoilbm -24if "%i" > "%o"
pov => "povray "+i"%i"" -D0 +o"%o" +fn%q +w%w +h%h +a -q9 -kfi"%s" -kff"%n" convert -concatenate %o*.png "%o"
ps<=>eps "C:/Program Files (x86)/gs/gs9.10/bin/gswin32c.exe" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 -sDEVICE=epswrite "-sOutputFile=%o" -- "%i"
ps<=>pdf "C:/Program Files (x86)/gs/gs9.10/bin/gswin32c.exe" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 -sDEVICE=pdfwrite "-sOutputFile=%o" -- "%i"
rgba<= rle "pnmtorle -o "%o" -v "%i"
scan => "scanimage -d "%i" > "%o"
shtml => "html2ps -U -o "%o" "%i"
sid => "mrsidgeodecode -if sid -i "%i" -of tif -o "%o" > "%u"
svg => "rsvg-convert" -o "%o" "%i"
txt<=>ps "enscript -o "%o" "%i"
wdp => "rename "%i" "%i.jxr"; "@JXRDecodeDelegate@" -i "%i.jxr" -o "%o.pnm"; rename "%i.jxr" "%i"; rename "%o.pnm" "%o"
wmf => "emfplus.exe -format png -dpi %x\x%y "%i" "%o"
xcf => "xcftopnm "%i" > "%o"
- Windows 7 Pro
- IIS v7.5
- PHP 5.3.10
- ImageMagick v6.7.6.0
- GhostScript v9.05
- Windows Server 2012
- IIS v8.0
- PHP v5.4.14
- ImageMagick v6.8.7-0
- GhostScript v9.10