简体   繁体   中英

imagemagick convert.exe error

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 

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

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");

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM