Help on getting IM to work on a windows server

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Nijo

Help on getting IM to work on a windows server

Post by Nijo »

Hi all,

i am working on a windows server and only have FTP access so i cannot use the console.

The sys admin installed imagemagick on the server for me but i am having trouble getting it to work.

I have tried the following code:

Code: Select all

<?php
echo "<pre>";
system('which convert', $path); 
print_r($path);
echo "</pre>";

exec('convert press_04.jpg -crop 287x163+49+16 graph2.gif');
echo "<br>".print_r($array)."<br>";

exec('convert W:\\www\\kmedev\\press_04.jpg -crop 287x163+49+16 W:\\www\\kmedev\\graph.gif');
echo "<br>".print_r($array)."<br>";


$path = "C:\\Program Files\\ImageMagick-6.3.6-Q16\\";
$cmd = $path . "convert.exe";
exec( $cmd .' W:\\www\\kmedev\\press_04.jpg W:\\www\\kmedev\\graph.gif');
echo "<br>".print_r($array)."<br>";
?>
But this ouputs:

Code: Select all

<pre>1</pre><br>1<br><br>1<br><br>1<br>
Since i do not have access to any log files or some such, i can hardly guess whats wrong.

Is there any way to geta more verbose answer from the server?
Or how do i create a batch script - would a content like "convert filea.jpg filgeb.eps" saved as test.bat be sufficient?

I really need to get this to work quickly but i have no idea where else to look, help pls ;)
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Help on getting IM to work on a windows server

Post by Bonzo »

1 = fail so all your comands failed

You could try this to find the path to convert instead. If this does not work I would say you have a setup error on the server and you need to talk to your system administrator again.
If he is happy it is installed OK get him to provide you with the path to convert.

Code: Select all

<?php
echo "<pre>";
system("type convert"); 
echo "</pre>";
?>
Nijo

Re: Help on getting IM to work on a windows server

Post by Nijo »

This just echoes

Code: Select all

<pre></pre>
.

The path to convert should be:

Code: Select all

$path = "C:\\Program Files\\ImageMagick-6.3.6-Q16\\";
$cmd = $path . "convert.exe";
The sys admin sent me this error message from the log:
Apache logs report this:
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

So i included the path in single quotes, but nothing changed.
Nijo

Re: Help on getting IM to work on a windows server

Post by Nijo »

Can i somehow check if IM is installed correctly?

Should anything show up in phpinfo?
Nijo

Re: Help on getting IM to work on a windows server

Post by Nijo »

Okay, the sys admin had the glorious idea to restart the server and it works fine now.
Thanks for your efforts ;)
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Help on getting IM to work on a windows server

Post by Bonzo »

I am glad you got it sorted OK.
Post Reply