function image_resize

You are here

7 image.inc image_resize(stdClass $image, $width, $height)
4.6 image.inc image_resize($source, $destination, $width, $height)
4.7 image.inc image_resize($source, $destination, $width, $height)
5 image.inc image_resize($source, $destination, $width, $height)
6 image.inc image_resize($source, $destination, $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

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.
3 string references to 'image_resize'
ImageAdminStylesUnitTest::testStyle in modules/image/image.test
General test to add a style, add/remove/edit effects to it, then delete it.
ImageStyleFlushTest::testFlush in modules/image/image.test
General test to flush a style.
image_image_effect_info in modules/image/image.effects.inc
Implements hook_image_effect_info().

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

Comments

Where would the image destination for resized one? In D6 , there is a parameter to pass as $destination.

How to parse the destination?

How to pass the destination?

$imgSmall = image_load($source_path);
image_resize($imgSmall, 50, 50);
image_save($imgSmall,$destination_path);