function manualcrop_crop_effect in Manual Crop 7
Image effect callback; Crop an image resource.
Parameters
$image: An image object returned by image_load().
$data: An array of attributes, needed to perform the crop effect, with the following items:
- "width": An integer representing the desired width in pixels.
- "height": An integer representing the desired height in pixels.
- "style_name": The style's machine name.
Return value
TRUE on success, FALSE on failure to crop image.
See also
1 string reference to 'manualcrop_crop_effect'
- manualcrop_image_effect_info in ./
manualcrop.module - Implements hook_image_effect_info().
File
- ./
manualcrop.module, line 870
Code
function manualcrop_crop_effect(&$image, $data) {
$crop = manualcrop_load_crop_selection($image->source, $data['style_name']);
if ($crop) {
$data['width'] = $crop->width;
$data['height'] = $crop->height;
$data['anchor'] = $crop->x . '-' . $crop->y;
return image_crop_effect($image, $data);
}
elseif (!empty($data['reuse_crop_style'])) {
return manualcrop_reuse_effect($image, $data);
}
return TRUE;
}