_imageapi_imagemagick_convert_exec() currently considers that anything that convert outputs in stderr is an error that should be reported (in red) to any users, including anonymous.

That's wrong for two reasons:

  • convert outputs warning to stderr in some conditions, for example when parsing non-totally-compliant images. Those warnings don't result in the conversion failing, and they should not be displayed
  • displaying error messages to every visitors, without a way to remove them, is a bad practice
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Damien Tournoud’s picture

Status: Active » Needs review
FileSize
1.64 KB

Here is what I suggest:

  • Rely solely on the return code to decide if stderr is an error or not
  • If we identified an imagemagick error, throw a PHP error. This error will be then caught by Drupal error handler, that will log it to watchdog and eventually display it to the user if configured to do so.
drewish’s picture

Status: Needs review » Fixed

Thanks, committed to HEAD and DRUPAL-6--1.

Damien Tournoud’s picture

Status: Fixed » Needs review
FileSize
842 bytes

I got the condition upside down in this patch, sorry (last minute cleanups...).

mikejoconnor’s picture

FileSize
944 bytes

DamZ:

That patch looks good, and solves the issue. I've attached an alternative, which does two things.

  1. It checks to make sure we have an error to report
  2. It adds the error code to the message
mikejoconnor’s picture

FileSize
1.21 KB

Here is another patch, which cleans this up a bit more.

We always report the error code, however we add some logic to print the error message, if it exists.

Damien Tournoud’s picture

Status: Needs review » Reviewed & tested by the community

Tested, looks good to me.

drewish’s picture

Status: Reviewed & tested by the community » Needs work
+        trigger_error(t("ImageMagick reported error code !code,\nMessage:\n!error", array('!code' => $return_code, '!error' => $errors)), E_USER_ERROR);

Seems like there should either be a period or Message should be lowercase.

mikejoconnor’s picture

Status: Needs work » Needs review
FileSize
1.21 KB

I just realized this didn't make it in. Here's an update. replaced the , with a .

kaare’s picture

Yup. this patch works for me.

drewish’s picture

Status: Needs review » Fixed

Thanks, committed to HEAD and DRUPAL-6--1.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.