JDTornado Posted October 18, 2010 Share Posted October 18, 2010 Hi, I have been pulling my hair out for the last week trying to figure this out and am just stuck. I have a set of PDF's (roughly 3,000) that I will need to convert to JPG's. I can do this using a batch through photoshop, but after it is done, I will need all new PDF's that are uploaded to be converted to a large JPG and a thumbnail JPG. Through my research it has appeared that the best way to do this is by using GraphicsMagick, with GhostScript. I am trying to get this to work with: Windows 2008 rc2 IIS 7 PHP 5.3.3 Non-Thread Safe GraphicsMagick-1.3.12-Q8 GhostScript 9.00 php_gmagick_nts.dll from http://valokuva.org/builds/ After I got everything installed on the server, it works fine through command line. I can convert a PDF to a jpg with no problems using something like: gm convert test.pdf[0] test.jpg However, when I use this PHP script: <?php //Instantiate a new Gmagick object $image = new Gmagick('C:\inetpub\siteDir\test.pdf[0]'); //Make thumbnail from image loaded. 0 for either axes preserves aspect ratio $image->thumbnailImage(100, 0); header( "Content-Type: image/jpeg" ); echo $image; ?> I get the following error: thrown in C:\inetpub\siteDir\drawings.php on line 13 #1 {main} #0 C:\inetpub\siteDir\drawings.php(13): Gmagick->__construct('C:\inetpub\sit....') Stack trace: [17-Oct-2010 18:40:46] PHP Fatal error: Uncaught exception 'GmagickException' with message 'Postscript delegate failed (C:\inetpub\siteDir\test.pdf)' in C:\inetpub\siteDir\drawings.php:13 I have tried doing this as well: <?php exec('gm convert C:\\inetpub\\siteDir\\test.pdf[0] C:\\inetpub\\siteDir\\test.jpg'); ?> If I do that in the command line on the server, it works without any problems. When I do that in the PHP script, I get no errors, but the conversion doesn't happen either. Does anyone have any ideas? Is there a better method for doing this? Am I just missing something? Any help would be greatly appreciated. Thanks! Quote Link to comment Share on other sites More sharing options...
JDTornado Posted October 18, 2010 Author Share Posted October 18, 2010 I tried using Imagick as well, and am getting pretty much the same issue. Any ideas? Quote Link to comment Share on other sites More sharing options...
litebearer Posted October 18, 2010 Share Posted October 18, 2010 See last entry http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=8398 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.