--- imagefield_gallery_lightbox2.module.orig	2008-03-03 18:13:39.000000000 +0100
+++ imagefield_gallery_lightbox2.module	2008-03-03 18:15:22.000000000 +0100
@@ -369,7 +369,13 @@ function theme_imagefield_gallery_lightb
     while ($i < $count) {
       if ($images[$i]['filepath']) {
         $file['filepath'] = $images[$i]['filepath'];
-	    $imagecache_path = base_path() . file_directory_path() .'/imagecache/'. $preview .'/'. $file['filepath'];
+            // Check for public files.
+            if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE) {
+              $file_directory_path = 'system/' . file_directory_path();
+            } else {
+              $file_directory_path = file_directory_path();
+            }
+	    $imagecache_path = base_path() . $file_directory_path .'/imagecache/'. $preview .'/'. $file['filepath'];
 	    $output .= '<div class="'. $node->type .'_image_field_thumbnail">';
 	    $output .= '<a href="'. $imagecache_path .'" rel="lightbox['. $node->nid .']" title="'. $images[$i]['title'] .'">';
 	    $output .= theme('imagecache', $thumbnail, $file['filepath'], $images[$i]['alt'], $images[$i]['title']);
