ImageMagick with php - system()
Posted: 2007-06-29T13:57:23-07:00
I have installed ImageMagick and GhostScript (Windows/IIS) and IM is working from the command line (specifically the convert command) so now I need to get it working in php. To that end I have the following code:
<?php
system("c:Program Files\ImageMagick-6.3.4-Q16\convert.exe c:\Inetpub\wwwroot\exp\graphics\imgMagick\test_file.ai c:\Inetpub\wwwroot\exp\graphics\imgMagick\AIC.png",$retvar);
echo $retvar; // Now you can check the $retvar for errors
?>
c:Program Files\ImageMagick-6.3.4-Q16\convert.exe - the root folder for IM, location of convert.exe
c:\Inetpub\wwwroot\exp\graphics\imgMagick\test_file.ai - the location of the target image to use for conversion
c:\Inetpub\wwwroot\exp\graphics\imgMagick\AIC.png - the location, name, and format for the converted image
Using the above code, it does not create a new png image. Before I set the permissions for the Internet Guest Account user to "read & execute" for the cmd.exe file located at C:\WINDOWS\system32, $retvar was echoing a value of -1. Once I set the permissions on C:\WINDOWS\system32\cmd.exe, $retvar is echoing a value of 1. In either case, the new graphic is NOT generated. Is there something wrong with my syntax? Any feedback will be greatly appreciated.
<?php
system("c:Program Files\ImageMagick-6.3.4-Q16\convert.exe c:\Inetpub\wwwroot\exp\graphics\imgMagick\test_file.ai c:\Inetpub\wwwroot\exp\graphics\imgMagick\AIC.png",$retvar);
echo $retvar; // Now you can check the $retvar for errors
?>
c:Program Files\ImageMagick-6.3.4-Q16\convert.exe - the root folder for IM, location of convert.exe
c:\Inetpub\wwwroot\exp\graphics\imgMagick\test_file.ai - the location of the target image to use for conversion
c:\Inetpub\wwwroot\exp\graphics\imgMagick\AIC.png - the location, name, and format for the converted image
Using the above code, it does not create a new png image. Before I set the permissions for the Internet Guest Account user to "read & execute" for the cmd.exe file located at C:\WINDOWS\system32, $retvar was echoing a value of -1. Once I set the permissions on C:\WINDOWS\system32\cmd.exe, $retvar is echoing a value of 1. In either case, the new graphic is NOT generated. Is there something wrong with my syntax? Any feedback will be greatly appreciated.