Help setting up imagick & ghostscript (will pay for help!)

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Posts: 1
Joined: 2012-10-09T22:45:05-07:00
Authentication code: 67789

Help setting up imagick & ghostscript (will pay for help!)

Post by pghwebs »

I desperately need help with image magick, anyone that gives me a straight answer with this problem I will paypal you a nice $10 bucks if your solution works (not much I know I'm just looking for the right answer on this forum, not hours of your time). Anyway what I am trying to do is convert the first page of a PDF file into an image, any format will do jpg, gif, or png. Unfortunately this has been nothing but an absolute nightmare for me. Let me say this; I have been programming for close to a decade, a college educated programmer with years of experience. I almost NEVER have to ask for help with things, but I have literally exhausted every option out there. I have scoured the web for hours, searched these forums, I need real help from someone for my particular case. I've invested too much time and energy finding a solution to this. Now moving on...
After about 30+ painful hours of trying to get image magick installed on a Windows 7 dedicated server with PHP, I succeeded! But now the second part, I need "ghostscript" to be able to convert PDFs to JPG's. And that is the problem. I keep getting a "PostscriptDelegateFailed" error. Now before jumping the gun please read the rest of my post, as I have installed ghost script numerous times as well as reinstalled imagick rebooting the server everytime and could NOT get this working.

Here is the PHP code I am using with a test PDF.

Code: Select all

$im = new imagick('site.pdf[0]');
$im->setImageFormat( "jpg" );
header( "Content-Type: image/jpg" );
echo $im;
Here is the error I am receiving:
Fatal error: Uncaught exception 'ImagickException' with message 'PostscriptDelegateFailed `C:\inetpub\vhosts\\httpdocs\site.pdf': No such file or directory' in C:\inetpub\vhosts\\httpdocs\test.php:4 Stack trace: #0 C:\inetpub\vhosts\\httpdocs\test.php(4): Imagick->__construct('site.pdf') #1 {main} thrown in C:\inetpub\vhosts\\httpdocs\test.php on line 4

In addition I also tried this and it does nothing (literally):

Code: Select all

exec("convert C:\inetpub\vhosts\\httpdocs\uploads\site.pdf[0] C:\inetpub\vhosts\\httpdocs\test.jpg");  
Here are problems I am routing this too:
1) I don't believe there is any communication between ghostscript and imagick
2) When I run the convert -list configure command in command prompt, ghost script does not come up for one of the delegates even though ghost script is installed
3) I started from scratch; I uninstalled image magic, installed ghost script then image magic afterwards, then when that didn't work vice versa, I tried 32 bit and 64 bit versions of ghost script, and I rebooted the server every time after, NEVER EVER WORKS! Only ghost script STATIC 32bit windows 16
4) I've checked the delegates XML file, registries, everything

Here is more information about my installation setup:
1) image magic v6.7.9 installed to C:/imagick
2) Ghostscript v9.0.6 installed to C:/gs
3) image magic works fine everywhere and in command prompt

Can someone please tell me what I am supposed to do to get this working? It's driving me nuts, this is the second most stressful workday I've had of the year trying to figure this out. Am I suppose to modify the delegates XML file? Am I suppose to use a different version of either software? I've tried installing them in order from one to the other, nothing ever works. I don't know what else to do at this point to make it work. I can't seem to find the right answer on the web I would really appreciate it if someone would help me.
Posts: 188
Joined: 2011-08-17T06:46:40-07:00
Authentication code: 8675308

Re: Help setting up imagick & ghostscript (will pay for help

Post by henrywho »

Why don't you use ghostscript to convert the pdf to jpeg?
Post Reply