Hi,
I am calling the convert command line program from PHP with the following command:
exec( $cmd, $output = array(), $return_var );
$cmd has the full command line, e. g.:
/usr/bin/convert "photos_gallery/2010-01-05_Myanmar/RP_2010-01-09_0920_01_thumb.jpg" -write temp/307_thumb_h240.icc -resize x240 -unsharp 1x2+1+0.1 -quality 80 -strip -profile temp/307_thumb_h240.icc "photos_cache/307_thumb_h240.jpg"
Now if something is wrong, then $return_var is always 1, regardless of what error or warning ImageMagick got.
Is there any way to get from PHP the real error/warning code?
My problem is that it seems I get a warning, the $return_val is 1 but the output file is actually there. I'd like to find out what is wrong but I do not have command line access to my hosting server. I also cannot reproduce the issue locally.
Cheers, Robert
Calling convert from PHP, how to get return code?
Re: Calling convert from PHP, how to get return code?
Try:
Code: Select all
$array=array();
echo "<pre>";
exec("$cmd 2>&1", $array);
echo "<br>".print_r($array)."<br>";
echo "</pre>";
Re: Calling convert from PHP, how to get return code?
Thanks!
Somehow my issue stopped occurring by itself. But next time it happens I'll try that code.
Somehow my issue stopped occurring by itself. But next time it happens I'll try that code.
