1

I'm trying to get ImageMagick working on my local machine (Mac) mainly to test it works without having to upload it to the server it will eventually be running on, but also because it should and it's annoying me that it's not!

So I'm converting a pdf to a gif and I've got IMGK and GhostWriter all installed and I've even got it converting successfully when running from the command line, just the way I want it. Here's the command I'm using:

convert file.pdf[0] -antialias -resize 105x150\! -shave 1x1 -bordercolor "#000000" -border 1x1 -colors 64 file.gif

I tried running it in PHP using exec but it won't have any of it. I've checked the permissions of the source and destination files and run chmod 777 on them just for good measure so I don't think it's that.

If I run convert with no arguments and use the second variable to PHP's exec to log the output I get the usual help text with all the various options and switches available, so I know that exec is working and convert is accessible to the process. However when I add the arguments I get no output, either logged to the second variable or in the way of converted images.

Very odd, very frustrating!

Any suggestions?

Mark Stickley
  • 1,000
  • 1
  • 12
  • 28

1 Answers1

1

My guess would be that your PHP user doesn't have the rights to write into the current directory, therefore ImageMagick must fail (because it runs with the permissions of the PHP user when called through exec().) Try giving the directory "world writable" rights using chmod.

To catch the error message that IM is (probably) producing, see this question.

Community
  • 1
  • 1
Pekka
  • 442,112
  • 142
  • 972
  • 1,088
  • Hi Pekka, thanks for the answer. World writable rights should be covered when I run `chmod 777`, right? I definitely did that on both the source and destination. – Mark Stickley Jan 24 '11 at 21:25
  • I tried switching on verbose mode on IM though and this is what I get when I run it through exec: `convert: missing an image filename `/users/stickm01/Desktop/tmp/profile_pic_screen-updated.gif' @ error/convert.c/ConvertImageCommand/2949. convert: unable to open image `/users/stickm01/Desktop/tmp/profile_pic_screen-updated.pdf': Permission denied @ error/blob.c/OpenBlob/2584. convert: missing an image filename `/users/stickm01/Desktop/tmp/profile_pic_screen-updated.gif' @ error/convert.c/ConvertImageCommand/2949.` – Mark Stickley Jan 24 '11 at 21:32