how to show IM error info in php?

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?".

how to show IM error info in php?

Postby linjuming » 2011-02-14T21:00:05+00:00

I use exec function to debug the im code. but it can not show the error info,so if the code is not correct ,i must run in cmd to see the error info,it is painful for me every time. Is there any method to show the error info in php?

Image
linjuming
 
Posts: 122
Joined: 2011-01-25T00:09:50+00:00

Re: how to show IM error info in php?

Postby fmw42 » 2011-02-14T21:24:31+00:00

read up about exec function arguments, one is a message array.

try this

<?php
exec("/usr/local/bin/convert -version",$out,$returnval);
print_r($out[0]);
?>

or

<?php
exec("/usr/local/bin/convert -list",$out,$returnval);
print_r($out);
?>

or use shell_exec as follows

<?php
$IM_version=shell_exec("/usr/local/bin/convert -version");
echo $IM_version
?>
User avatar
fmw42
 
Posts: 14540
Joined: 2007-07-02T17:14:51+00:00
Location: Sunnyvale, California, USA

Re: how to show IM error info in php?

Postby linjuming » 2011-02-14T21:47:00+00:00

Thanks! i see now.
linjuming
 
Posts: 122
Joined: 2011-01-25T00:09:50+00:00

Re: how to show IM error info in php?

Postby anthony » 2011-02-14T23:12:16+00:00

How about stderr? :-)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
http://www.imagemagick.org/Usage/
User avatar
anthony
 
Posts: 8720
Joined: 2004-05-31T19:27:03+00:00
Location: Brisbane, Australia

Re: how to show IM error info in php?

Postby linjuming » 2011-02-15T00:15:47+00:00

Image

seems it doesn't work.
linjuming
 
Posts: 122
Joined: 2011-01-25T00:09:50+00:00

Re: how to show IM error info in php?

Postby linjuming » 2011-02-15T00:16:49+00:00

what is the meaning of "stderr" ?
linjuming
 
Posts: 122
Joined: 2011-01-25T00:09:50+00:00

Re: how to show IM error info in php?

Postby Bonzo » 2011-02-15T01:00:17+00:00

This is what I do and uses stderr:
Code: Select all
<?php
$array=array();
echo "<pre>";
exec("convert null.png good.png 2>&1", $array);
echo "<br>".print_r($array)."<br>";
echo "</pre>";
?>
Bonzo
 
Posts: 2178
Joined: 2006-05-20T08:08:19+00:00
Location: Cambridge, England

Re: how to show IM error info in php?

Postby linjuming » 2011-02-15T01:12:52+00:00

thank you very much !
linjuming
 
Posts: 122
Joined: 2011-01-25T00:09:50+00:00


Return to Users

Who is online

Users browsing this forum: Bing [Bot] and 22 guests