function image_scale_and_crop_effect

7.x image.effects.inc image_scale_and_crop_effect(&$image, $data)

Image effect callback; Scale and crop an image resource.

Parameters

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

$data: An array of attributes to use when performing the scale and crop 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 scale and crop image.

See also

image_scale_and_crop()

1 call to image_scale_and_crop_effect()
1 string reference to 'image_scale_and_crop_effect'
image_image_effect_info in drupal-7.x/modules/image/image.effects.inc
Implements hook_image_effect_info().

File

drupal-7.x/modules/image/image.effects.inc, line 207
Functions needed to execute image effects provided by Image module.

Code

function image_scale_and_crop_effect(&$image, $data) {
  if (!image_scale_and_crop($image, $data['width'], $data['height'])) {
    watchdog('image', 'Image scale and crop 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;
}