Display errors
<?php
//This will display a success or fail message
exec("convert image.jpg -crop x246+0+0 -resize 182x246! output.jpg", $output, $return);
if ($return == "0") { echo "<br>Image generation sucssesful<br>"; }
else { echo "<br>Image generation failed<br>"; }
echo $return;
foreach ( $output as $file )
print "$file<br>";
// This will print any errors
// Create an empty array to hold the errors
$array = array();
// Use <pre> to put each error on a seperate line
echo "<pre>";
exec("convert image.jpg -channel B -separate Output.png 2>&1", $array);
echo "<br>".print_r($array)."<br>";
echo "</pre>";
// Another method
$cmd_debug = ( TRUE )? '-debug exception' : '';
//or false; the \'\' is two single quote marks. A NULL should work also
//your string on a single line
$command= "image.jpg -resize x160 -resize \"160x<\" -resize 50% -gravity center -crop 80x80+0+0 +repage";
$file = "output.jpg";
//php path rule to file
exec("convert $cmd_debug $command $file", $IMarray, $code);
echo "<pre>";
print_r( $IMarray );
echo "</pre>";
?>Different methods of displaying errors.