I found I needed to change theme_apachesolr_image_snippet() to make it work. I haven't tested this fix on public files.

Index: modules/apachesolr/contrib/apachesolr_image/apachesolr_image.module
===================================================================
--- modules/apachesolr/contrib/apachesolr_image/apachesolr_image.module	(revision 16910)
+++ modules/apachesolr/contrib/apachesolr_image/apachesolr_image.module	(working copy)
@@ -46,7 +46,7 @@
 }
 
 function theme_apachesolr_image_snippet($item){
- return '<span class="apachesolr-image-result">'. theme('image', $item['node']->ss_image_relative, $item['title'], $item['title'], array('align' => 'left')) .'</span>'. $item['snippet'] . '<br clear="all"/>';
+  return '<span class="apachesolr-image-result">'. theme('image', file_create_url($item['node']->ss_image_relative), $item['title'], $item['title'], array('align' => 'left'), FALSE) .'</span>'. $item['snippet'] . '<br clear="all"/>';
 }

Comments

pwolanin’s picture

Version: 6.x-1.0-rc3 » 6.x-1.x-dev

can you attach this as a patch?

jpmckinney’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Status: Active » Fixed
jpmckinney’s picture

Actually, reverted. This will break public files.

In D6, theme_image does this:

$url = (url($path) == $path) ? $path : (base_path() . $path);

With public files, file_create_url will return a URL that does not satisfy url($path) == $path, so base_path() will be prepended.

To fix image results for private files, you should implement theme_image:

function custom_image($path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE) {
  if (!$getsize || (is_file($path) && (list($width, $height, $type, $image_attributes) = @getimagesize($path)))) {
    $attributes = drupal_attributes($attributes);
    $url = file_create_url($path);
    return '<img src="' . check_url($url) . '" alt="' . check_plain($alt) . '" title="' . check_plain($title) . '" ' . (isset($image_attributes) ? $image_attributes : '') . $attributes . ' />';
  }
}
jpmckinney’s picture

Status: Fixed » Closed (won't fix)