function image_resize

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

Parameters

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

int $width: The target width, in pixels.

int $height: The target height, in pixels.

Return value

bool TRUE on success, FALSE on failure.

See also

image_load()

\Drupal\system\Plugin\ImageToolkitInterface::resize()

Related topics

4 calls to image_resize()
image_resize_effect in drupal/core/modules/image/image.effects.inc
Image effect callback; Resize an image resource.
image_scale in drupal/core/includes/image.inc
Scales an image while maintaining aspect ratio.
image_scale_and_crop in drupal/core/includes/image.inc
Scales an image to the exact width and height given.
ToolkitTest::testResize in drupal/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTest.php
Test the image_resize() function.

File

drupal/core/includes/image.inc, line 214
API for manipulating images.

Code

function image_resize($image, $width, $height) {
  $width = (int) round($width);
  $height = (int) round($height);
  return $image->toolkit
    ->resize($image, $width, $height);
}