You are here

function focal_point_scale_and_crop_effect in Focal Point 7

Image effect callback.

1 string reference to 'focal_point_scale_and_crop_effect'
focal_point_image_effect_info in ./focal_point.effects.inc
Implements hook_image_effect_info().

File

./focal_point.effects.inc, line 37
Default image preset.

Code

function focal_point_scale_and_crop_effect(&$image, $data) {
  $resize_data = focal_point_effect_resize_data($image->info['width'], $image->info['height'], $data['width'], $data['height']);
  if (!image_resize_effect($image, $resize_data)) {
    return FALSE;
  }
  if ($crop_data = focal_point_effect_crop_data($image, $data)) {

    // Next we crop.
    return image_crop_effect($image, $crop_data);
  }

  // At worst use the default effect and let Drupal handle the errors that
  // likely exist at this point.
  return image_scale_and_crop_effect($image, $data);
}