function image_resize

image_resize(stdClass $image, $width, $height)

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

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!image.inc/function/image_resize/7.x