我試圖將PDF文件轉換爲PNG文件。它從命令行很好(我的GhostScript 8.64已經安裝)。但是,從PHP我有一個問題:ImageMagick/Imagick使用原生PHP API將PDF轉換爲JPG
代碼:
$im = new Imagick($pdf_file); // this is where it throws the exception below
輸出:
Fatal error: Uncaught exception ‘ImagickException’ with message ‘Postscript delegate failed `23_1235606503.pdf’: No such file or directory @ pdf.c/ReadPDFImage/612′ in get_thumbnail.php:93
Stack trace:
\#0 get_thumbnail.php(93): Imagick->__construct(’…’)
等等,等等
我不知道我在做什麼這裏錯了,但我懷疑它與我的服務器配置有關。我運行: 的Apache 2.2.11 PHP 5.2.8 的ImageMagick 6.4.8-9 GhostScript的8.64
如何知道apache環境路徑是什麼? – 2013-06-19 15:53:02
非常好!只需要添加,像這樣創建符號鏈接:sudo ln -s/usr/local/bin/gs/usr/bin/gs – Ondrej 2014-02-07 17:47:28
保持獲取`無法讀取文件錯誤`並且解決了這個問題。多謝兄弟。 – 2015-06-02 22:10:06