You are here

function smartcrop_crop_effect in Smart Crop 7

Image effect callback; Smart Crop 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.

1 string reference to 'smartcrop_crop_effect'
smartcrop_image_effect_info in ./smartcrop.effects.inc
Implements hook_image_effect_info().

File

./smartcrop.effects.inc, line 79
Functions needed to execute image effects provided by the SmartCrop module.

Code

function smartcrop_crop_effect(&$image, $data) {
  if (!image_toolkit_invoke('smartcrop_crop', $image, $data)) {
    watchdog('image', 'Smart 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['height'] . 'x' . $image->info['height'],
    ), WATCHDOG_ERROR);
    return FALSE;
  }
  return TRUE;
}