Page 1 of 1

Problem converting PDF to JPG with PHP -works from the shell

Posted: 2014-06-20T11:44:11-07:00
by nimbfire
Hi =)

I'm having trouble to convert a .pdf file to .jpg (or other imagelike files) using php.

When I run "convert pdf.pdf image.jpg" in the terminal, it works. But when I call it with an shell_exec I got an error

Code: Select all

shell_exec( ' "C:\Program Files (x86)\ImageMagick-6.8.9-Q16\convert.exe" archive.pdf image.jpg 2>&1');
  convert.exe: no images defined `image.jpg' @ error/convert.c/ConvertImageCommand/3187.
But with

Code: Select all

shell_exec( ' "C:\Program Files (x86)\ImageMagick-6.8.9-Q16\convert.exe" archive.jpg image.jpg 2>&1');
works fine and creates the image.jpg correctly

I've installed the x86 versions of PHP (5.4), GhostScript and Imagemagick. Tried the dll and static versions.
And I'm using Windows Server 2012 R2 Essentials x64

What am I doing wrong?
Thanks for any help in advance :)