0

Here is my code below

exec("convert -page 90x54 script_o.gif \\( script_o.gif -repage +37+0\! \) output.gif");

which works fine on my webserver(centos), but it does not work on my wamp server, but i have checked other im codes which works fine on wamp server,is there any fix for the above code for wamp server

Friend
  • 1,326
  • 11
  • 38
  • 62

1 Answers1

1

The problem is windows already have a binary called convert to convert FAT volumes to NTFS, that binary is in the PATH so it gets executed instead of your imagemagick one. To try that, just open a windows shell and type convert /? and hit ENTER you will see the output of that other convert .

The solution is to specify in your command the absolute path to your imagemagick convert binary.

Something like this:

exec("c:\\imagemagick_folder\\bin\\convert.exe -page 90x54 script_o.gif \\( script_o.gif -repage +37+0\! \) output.gif");
Nelson
  • 49,283
  • 8
  • 68
  • 81
  • k let me change it to full path...and let you know .thank you – Friend Mar 24 '13 at 06:07
  • I've updated my answer with an example command, just use double backslash to delimit folders. – Nelson Mar 24 '13 at 06:12
  • Hi Nelson, i have changed my code but still not fixed `exec("c:\\imagemagick\\convert.exe -page 90x54 script_o.gif \\( script_o.gif -repage +37+0\! \) output.gif");` convert.exe is inside imagemagick folder...and one more thing iam running this through php not through command – Friend Mar 24 '13 at 06:17
  • That is another problem, probaby the parametes you are passing are wrong, your escapes like `\\(` and `\)` seem suspicious to me maybe you dont need them, anyway just check the output of executing convert.exe alone to see if you get the output of imagemagick then you know the correct binary is being called and then you go to fix the parameters. – Nelson Mar 24 '13 at 06:22
  • hmm i just tried renaming imagemagick `convert` to `convertme` then tried running the samecode without giving any location, but still the same prob :( – Friend Mar 24 '13 at 06:25