function image_focus_get_focal_point in Image Focus Crop 6
Same name and namespace in other branches
- 7 image_focus.module \image_focus_get_focal_point()
Returns the focal point of the image.
1 call to image_focus_get_focal_point()
- image_focus_scale_and_crop_image in ./
image_focus.module - Image callback for the image_focus_scald_and_crop action.
File
- ./
image_focus.module, line 70 - Image Focus Crop module.
Code
function image_focus_get_focal_point($image) {
$extension = str_replace('jpg', 'jpeg', $image->info['extension']);
$function = 'imagecreatefrom' . $extension;
if (function_exists($function) && ($resource = $function($image->source))) {
// Try different algorithms.
if ($image->info['file_size'] <= variable_get('image_focus_face_detection_maxsize', 50 * 1024) && ($result = image_focus_get_focal_point_face_detection($resource))) {
return $result;
}
if ($result = image_focus_get_focal_point_entropy($resource)) {
return $result;
}
}
return array(
$image->info['width'] / 2,
$image->info['height'] / 2,
);
}