You are here

function image_imageinfo_cache_crop in Imageinfo Cache 7.3

Crops an image to the given coordinates.

Parameters

object $image: An image object. The $image->resource, $image->info['width'], and $image->info['height'] values will be modified by this call.

int $x: The starting x offset at which to start the crop, in pixels.

int $y: The starting y offset at which to start the crop, in pixels.

int $width: The width of the cropped area, in pixels.

int $height: The height of the cropped area, in pixels.

Return value

bool TRUE or FALSE, based on success.

See also

image_crop()

File

./imageinfo_cache.toolkit.inc, line 149
Imageinfo Cache module. Pseudo image toolkit functions.

Code

function image_imageinfo_cache_crop($image, $x, $y, $width, $height) {

  // Change toolkit back to the original value.
  $image->toolkit = variable_get('image_toolkit_original', 'gd');
  $return = image_toolkit_invoke('crop', $image, array(
    $x,
    $y,
    $width,
    $height,
  ));

  // Change toolkit to the pseudo value again.
  $image->toolkit = variable_get('image_toolkit', 'gd');
  return $return;
}