You are here

function imagecrop_reuse_effect in Image javascript crop 7

Image effect callback: Crop the image based on the image style.

Parameters

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

$data An array with the preset to use..:

Return value

TRUE on success. FALSE on failure to crop the image.

1 string reference to 'imagecrop_reuse_effect'
imagecrop_image_effect_info in includes/imagecrop.effects.inc
Implements hook_image_effect_info().

File

includes/imagecrop.effects.inc, line 267
Registry for the image style effects from imagecrop.

Code

function imagecrop_reuse_effect(&$image, $data) {
  if (empty($data['imagecrop_style'])) {
    return FALSE;
  }

  // Load selected image style and apply the imagecrop_javascript action.
  $style = image_style_load($data['imagecrop_style']);
  foreach ($style['effects'] as $effect) {
    if ($effect['name'] == 'imagecrop_javascript') {
      $GLOBALS['imagecrop_style'] = $style['name'];
      image_effect_apply($image, $effect);
      return TRUE;
    }
  }
  return FALSE;
}