You are here

function imageapi_toolkit_invoke in ImageAPI 6

Same name and namespace in other branches
  1. 5 imageapi.module \imageapi_toolkit_invoke()

Invokes the given method using the currently selected toolkit.

Parameters

$method: A string containing the method to invoke.

$image: An image object returned by imageapi_image_open().

$params: An optional array of parameters to pass to the toolkit method.

Return value

Mixed values (typically Boolean indicating successful operation).

7 calls to imageapi_toolkit_invoke()
imageapi_image_close in ./imageapi.module
Close the image and save the changes to a file.
imageapi_image_crop in ./imageapi.module
Crop an image to the rectangle specified by the given rectangle.
imageapi_image_desaturate in ./imageapi.module
Convert an image to grayscale.
imageapi_image_open in ./imageapi.module
Open an image file and return an image object.
imageapi_image_resize in ./imageapi.module
Resize an image to the given dimensions (ignoring aspect ratio).

... See full list

File

./imageapi.module, line 160
An ImageAPI supporting additional image plugins as modules. Images are treated as objects, and images are not written per manipulation as Drupal's core image handling works.

Code

function 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;
}