I was doing some testing (http://drupal.org/node/818798#comment-3927766) and found that the return code from proc_close is 0, regardless any (error) messages send to stderr.

file: imageapi_imagemagick.module
function: _imageapi_imagemagick_exec

command line:

"C:\Program Files\ImageMagick-6.6.1-Q16\convert.exe" "D:\Projecten\Drupal7\www\modules\image\sample.png" -resize 180x135! -crop 180x135+0+0!   -background '#333333'   -crop   '184x139-2-2!'   -extent '184x139-2-2!'  -quality "75" "D:\Projecten\Drupal7\sample.png"

Output on stderr (as saved in $errors):

convert.exe: unrecognized color `'#333333'' @ warning/color.c/GetColorInfo/946.
convert.exe: invalid geometry `'184x139-2-2!'' @ error/geometry.c/ParseGravityGeometry/990.
convert.exe: unrecognized color `'#333333'' @ warning/color.c/GetColorInfo/946.
convert.exe: invalid geometry `'184x139-2-2!'' @ error/geometry.c/ParseGravityGeometry/990.
convert.exe: unrecognized color `'#333333'' @ warning/color.c/GetColorInfo/946.
convert.exe: invalid geometry `'184x139-2-2!'' @ error/geometry.c/ParseGravityGeometry/990.
convert.exe: unrecognized color `'#333333'' @ warning/color.c/GetColorInfo/946.
convert.exe: invalid geometry `'184x139-2-2!'' @ error/geometry.c/ParseGravityGeometry/990.

Configuration:

Windows Vista
ImageMagick 6.6.1-6 2010-04-23 Q16

So I think it is better to check for return code OR $errors in deciding whether or not to call trigger_error() (and inform the user). But this might lead to false positives as I'm not sure about when convert sends output to stderr while returning 0 at the same time.

CommentFileSizeAuthor
#1 1021690.patch657 bytesfietserwin

Comments

fietserwin’s picture

StatusFileSize
new657 bytes

And as a patch (against the 7.x-1.x-dev 2010-Oct-18 version).

sun’s picture

Project: ImageAPI » ImageMagick
Component: ImageAPI Imagick » Code

Moving to ImageMagick. Potentially related, since you're on Windows: #1196008: Investigate new proc_open() $other_options on PHP5

sun’s picture

Status: Active » Needs work
fietserwin’s picture

Status: Needs work » Closed (duplicate)

I tested the bypass_shell option as suggested in #1196008: Investigate new proc_open() $other_options on PHP5 and with that option $return_code and $errors are "ïn line" with each other (i.e: !empty($errors) => $error_code != 0). So this issue can be closed as a duplicate.