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?".
linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

how to show IM error info in php?

Postby linjuming » 2011-02-14T21:00:05-07: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

User avatar
fmw42
Posts: 15272
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA
Contact:

Re: how to show IM error info in php?

Postby fmw42 » 2011-02-14T21:24:31-07: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
?>

linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

Re: how to show IM error info in php?

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

Thanks! i see now.

User avatar
anthony
Posts: 8736
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia
Contact:

Re: how to show IM error info in php?

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

How about stderr? :-)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
http://www.imagemagick.org/Usage/

linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

Re: how to show IM error info in php?

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

Image

seems it doesn't work.

linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

Re: how to show IM error info in php?

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

what is the meaning of "stderr" ?

Bonzo
Posts: 2274
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England
Contact:

Re: how to show IM error info in php?

Postby Bonzo » 2011-02-15T01:00:17-07: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>";
?>

linjuming
Posts: 122
Joined: 2011-01-25T00:09:50-07:00
Authentication code: 8675308

Re: how to show IM error info in php?

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

thank you very much !


Return to “Users”

Who is online

Users browsing this forum: No registered users and 12 guests