function focal_point_preview_page in Focal Point 7
Page callback function.
This page displays a preview of derivative images for the given file.
Parameters
int $fid: The fid of the image file entity in question.
string $focal_point: (Optional) A string in the form 'left-percent-offset, top-percent-offset'. Leave this value empty to use the value stored in the database.
Return value
array The render array for the preview page.
See also
hook_focal_point_crop_data_alter()
1 string reference to 'focal_point_preview_page'
- focal_point_menu in ./
focal_point.module - Implements hook_menu().
File
- ./
focal_point.admin.inc, line 117 - Functionality needed by the focal point admin pages.
Code
function focal_point_preview_page($fid, $focal_point = '') {
$file = is_numeric($fid) ? file_load($fid) : NULL;
if ($file && focal_point_validate($focal_point)) {
// Get the render array for the preview.
$output = _focal_point_preview($fid, $focal_point);
// Clear the existing derivative images if they exist.
image_path_flush($file->uri);
}
else {
drupal_set_message(t('Invalid request. The preview images could not be displayed.'), 'error');
$output = array();
}
return $output;
}