You are here

function imageapi_image_resize in ImageAPI 6

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

Resize an image to the given dimensions (ignoring aspect ratio).

Parameters

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

$width: The target width, in pixels.

$height: The target height, in pixels.

Return value

TRUE or FALSE, based on success.

2 calls to imageapi_image_resize()
imageapi_image_scale in ./imageapi.module
Scales an image to the given width and height while maintaining aspect ratio.
imageapi_image_scale_and_crop in ./imageapi.module
Scales an image to the exact width and height given.

File

./imageapi.module, line 261
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_image_resize(&$image, $width, $height) {
  $width = (int) round($width);
  $height = (int) round($height);
  return imageapi_toolkit_invoke('resize', $image, array(
    $width,
    $height,
  ));
}