function image_resize_effect

Image effect callback; Resize an image resource.

Parameters

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

$data: An array of attributes to use when performing the resize effect with the following items:

  • "width": An integer representing the desired width in pixels.
  • "height": An integer representing the desired height in pixels.

Return value

TRUE on success. FALSE on failure to resize image.

See also

image_resize()

1 call to image_resize_effect()
ImageEffectsUnitTest::testResizeEffect in modules/image/image.test
Test the image_resize_effect() function.
1 string reference to 'image_resize_effect'
image_image_effect_info in modules/image/image.effects.inc
Implements hook_image_effect_info().

File

modules/image/image.effects.inc, line 80

Code

function image_resize_effect(&$image, $data) {
    if (!image_resize($image, $data['width'], $data['height'])) {
        watchdog('image', 'Image resize failed using the %toolkit toolkit on %path (%mimetype, %dimensions)', array(
            '%toolkit' => $image->toolkit,
            '%path' => $image->source,
            '%mimetype' => $image->info['mime_type'],
            '%dimensions' => $image->info['width'] . 'x' . $image->info['height'],
        ), WATCHDOG_ERROR);
        return FALSE;
    }
    return TRUE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.