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

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
nimbfire
Posts: 1
Joined: 2014-06-20T11:06:14-07:00
Authentication code: 6789

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

Post 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 :)
Post Reply