You are here

function image_resize in Drupal 7

Same name and namespace in other branches
  1. 4 includes/image.inc \image_resize()
  2. 5 includes/image.inc \image_resize()
  3. 6 includes/image.inc \image_resize()

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

Parameters

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

$width: The target width, in pixels.

$height: The target height, in pixels.

Return value

TRUE on success, FALSE on failure.

See also

image_load()

image_gd_resize()

Related topics

4 calls to image_resize()
ImageToolkitUnitTest::testResize in modules/simpletest/tests/image.test
Test the image_resize() function.
image_resize_effect in modules/image/image.effects.inc
Image effect callback; Resize an image resource.
image_scale in includes/image.inc
Scales an image while maintaining aspect ratio.
image_scale_and_crop in includes/image.inc
Scales an image to the exact width and height given.

File

includes/image.inc, line 279
API for manipulating images.

Code

function image_resize(stdClass $image, $width, $height) {
  $width = (int) round($width);
  $height = (int) round($height);
  return image_toolkit_invoke('resize', $image, array(
    $width,
    $height,
  ));
}