Error in module ImageApi

Error:

  Error displayed when you use modules ImageApi, ImageCache
warning: Parameter 1 to imageapi_gd_image_resize() expected to be a reference, value given in .../modules/imageapi/imageapi.module on line 165


  Cause of the problem in using PHP version 5.3
The solution is quite easy, although it will have to rewrite slightly module imageapi. To do this, open the folder with the module and open the file in the editor imageapi.module. Then go to line 163 where we see the following:
<?phpfunction imageapi_toolkit_invoke($method, &$image, array $params = array()) {
 
$function = $image->toolkit . '_image_' . $method;
  if (
function_exists($function)) {
   
array_unshift($params, $image);
    return
call_user_func_array($function, $params);
  }
 
watchdog('imageapi', 'The selected image handling toolkit %toolkit can not correctly process %function.', array('%toolkit' => $image->toolkit, '%function' => $function), WATCHDOG_ERROR);
  return
FALSE;
}
?>
Now this function, we need to slightly adjust the following:
<?phpfunction imageapi_toolkit_invoke($method, &$image, array $params = array()) {
 
$function = $image->toolkit . '_image_' . $method;
  if (
function_exists($function)) {
   
array_unshift($params, $image);
       
$params[0] = &$image;
    return
call_user_func_array($function, $params);
  }
 
watchdog('imageapi', 'The selected image handling toolkit %toolkit can not correctly process %function.', array('%toolkit' => $image->toolkit, '%function' => $function), WATCHDOG_ERROR);
  return
FALSE;
}
?>

Post a Comment