You are here

function callback_get_focal_point in Focal Point 7

Callculate an image's focal point.

Callback for hook_focal_point_default_method_info().

Parameters

object $image: An image resource object from image_get_info().

Return value

array|null An array of coordinates to use as the focal point on the image. These values should be in pixels and represent the left and top offset from the image. For example: array(5, 25) would mean the focal point is 5 pixels from the left of the image, and 25 pixels from the top of the image.

1 string reference to 'callback_get_focal_point'
hook_focal_point_default_method_info in ./focal_point.api.php
Provide a default focal point calculation method.

File

./focal_point.api.php, line 117
Documentation of Feeds hooks.

Code

function callback_get_focal_point($image) {

  // Return a random point on the image.
  return array(
    mt_rand(0, $image->info['width']),
    mt_rand(0, $image->info['height']),
  );
}