The code in imageapi_image_scale() tries to divide by $image->info['width'] regardless of what width is. If $image->info['width'] is not set for whatever reason, this can cause the php warning: division by zero

Patch attached (against git checkout 6.x-1.x) to simply return FALSE, as there is not enough data to _scale().

#1 division-by-zero-1284010-1.patch850 bytesjzacsh
Members fund testing for the Drupal project. Drupal Association Learn more


jzacsh’s picture

Attached patch to avoid division by zero.

David Hernández’s picture

Hi there,

I'm not sure if the patch provided on #1 is a good solution. Instead of adding a line to avoid the function causing the error, will be better to find where the error is generated and fix it there. Why the image object doesn't have enough information?


David Hernández’s picture

Issue summary: View changes

Clarifying reason for bug's occurance.

NancyDru’s picture

NancyDru’s picture

In my case, I'm seeing the &$image parameter being FALSE.

Caller is imagefield/ at line 67.

I am also seeing in the log: "The selected image handling toolkit can not correctly process _image_close." This appears to be coming from imageapi_toolkit_invoke when $image->toolkit is empty (actually the image object is empty).