You are here

function apachesolr_image_apachesolr_update_index in Apache Solr Search 5

Same name and namespace in other branches
  1. 5.2 contrib/apachesolr_image/apachesolr_image.module \apachesolr_image_apachesolr_update_index()
  2. 6 contrib/apachesolr_image/apachesolr_image.module \apachesolr_image_apachesolr_update_index()
  3. 6.2 contrib/apachesolr_image/apachesolr_image.module \apachesolr_image_apachesolr_update_index()

File

contrib/apachesolr_image/apachesolr_image.module, line 3

Code

function apachesolr_image_apachesolr_update_index(&$document, $node) {
  if ($node->type == 'image') {
    $areas = array();
    $sizes = image_get_derivative_sizes($node->images['_original']);
    foreach ($sizes as $name => $info) {
      $areas[$name] = $info['width'] * $info['height'];
    }
    asort($areas);
    $image = FALSE;
    foreach ($areas as $preset => $size) {
      $image = $node->images[$preset];
      break;
    }
    if ($image) {
      $index_key = 'ssfield_imagemodule_image';
      $document->{$index_key} = $image;
    }
  }
}