function apachesolr_image_apachesolr_update_index in Apache Solr Search 6.2
Same name and namespace in other branches
- 5.2 contrib/apachesolr_image/apachesolr_image.module \apachesolr_image_apachesolr_update_index()
- 5 contrib/apachesolr_image/apachesolr_image.module \apachesolr_image_apachesolr_update_index()
- 6 contrib/apachesolr_image/apachesolr_image.module \apachesolr_image_apachesolr_update_index()
Implementation of hook_apachesolr_update_index().
File
- contrib/
apachesolr_image/ apachesolr_image.module, line 6
Code
function apachesolr_image_apachesolr_update_index(&$document, $node, $namespace) {
if ($node->type == 'image' && $document->entity == 'node') {
$areas = array();
// A problem here - small images do not get a derived thumbnail.
$sizes = image_get_derivative_sizes($node->images['_original']);
foreach ($sizes as $name => $info) {
$areas[$name] = $info['width'] * $info['height'];
}
asort($areas);
$image_path = FALSE;
foreach ($areas as $preset => $size) {
$image_path = $node->images[$preset];
break;
}
if ($image_path) {
$document->ss_image_relative = $image_path;
// Support multi-site too.
$document->ss_image_absolute = file_create_url($image_path);
}
}
}