问题
My code to convert planets.png to planets.jpg
<?php
exec("convert planets.png planets.jpg");
?>
Which is not working just showing blank page.
i have installed imagemagick as it is showing in phpinfo() View here
Is here any other configuration remaining to run that imagemagick code.
Error message
[Sat Jul 28 20:16:11 2012] [error] [client 127.0.0.1] PHP 1. {main}() D:\\wamp\\www\\test\\into.php:0 Invalid Parameter - planets.jpg
回答1:
This is why is important to have the error message. With it we can search for answers.
You have inadvertently run the Microsoft Windows program called convert.exe, rather than the ImageMagick program of the same name. The Windows convert.exe program is used to convert a system boot disk from MS-DOS "FAT" format to NTFS format. As such it can only be used one time in the life of a system. Source
Solutions
You can
- rename either the MS convert.exe or the ImageMagick convert.exe
- revise your PATH to put ImageMagick's convert.exe ahead of MS convert.exe
- edit your Windows Registry as explained in http://savage.net.au/ImageMagick/html/install-convert.html
回答2:
exec("convert planets.png planets.jpg");
This is exact equivalent of opening a command prompt window and executing this.
Also, as @Elzo pointed out, convert.exe is a built-in executable, so you will need to specify the entire path of the executable. (I'd suggest this rather than renaming either executable).
exec("\"C:\\Program Files\\..\\convert.exe\" planets.png planets.jpg");
回答3:
The ImageMagic extension for php has nothing to do with ImageMagics 'convert' command. It is separate software. Sure you have installed command installed on your system ? Try manually using it in a shell.
What shows up inside the phpinfo() is the ImageMagic extension. That one does not bring a 'convert' cli utility and has to be used quite different to what you attempt.
来源:https://stackoverflow.com/questions/11702187/imagemagick-convert-exe-error