--- brilliant_gallery.module	2009-10-25 18:16:37.000000000 -0400
+++ ../sites-backup/all/modules/brilliant_gallery/brilliant_gallery.module	2009-10-27 22:23:14.000000000 -0400
@@ -391,12 +392,12 @@
   if ($galleryfolder <> '') {
     $rp .= '/'. $galleryfolder;
   }
-  $absolpath = realpath($rp);
+  $absolpath = $rp;
   $result .= '<p>';
   $result .= '<p>This page allows you to set or unset visibility of each image (data item) in all Brilliant galleries there are on this website.';
   #$result .= '<p><b>Files folder:</b> ' . file_directory_path() . '/';
   ob_start();
-  $recurs = bg_iterative_recurse_dir($absolpath);
+  $recurs = bg_iterative_recurse_dir(realpath($absolpath));
   #echo '<pre>'; print_r( $recurs ); echo '</pre>';
   #echo '<pre>'; print_r( $retval_dimensions ); echo '</pre>';
   $result .= ob_get_contents();
@@ -418,12 +419,13 @@
     else {
       $rootfolder = '';
     }
-    $path_middle = str_replace($absolpath, '', $key);
+    $path_middle = str_replace(realpath($absolpath), '', $key);
+    $gallerypath = '/' . $galleryfolder . $path_middle;
     $result .= '<li><a href="?fld='. $galleryfolder . $path_middle .'">'. $galleryfolder . $path_middle . $rootfolder .'</a></li>';
     if ($galleryfolder . $path_middle == $_GET['fld']) {
       # User has asked to manage images in this folder.
       $tablerows         = array();
-      $temp              = load_dir_to_array($key, variable_get('brilliant_gallery_maximagewidth', 150), variable_get('brilliant_gallery_maxwidth', '1000'), 1, variable_get('brilliant_gallery_crop', FALSE));
+      $temp              = load_dir_to_array($galleryfolder, variable_get('brilliant_gallery_maximagewidth', 150), variable_get('brilliant_gallery_maxwidth', '1000'), 1, variable_get('brilliant_gallery_crop', FALSE));
       $retval_dimensions = $temp[0];
       $imagemaxh         = $temp[1];
       $maxpoct           = count($retval_dimensions);
@@ -462,7 +464,7 @@
           #else {
             # Important to begin with the "/" otherwise thumbnails in non-root folders fail. See http://drupal.org/node/175292
             #&dummy=.jpg
-            $displayimage .= '<a href="'. $modulepath .'/image.php?imgp='. base64_encode($absolpath . $path_middle .'/'. $retval[$poct - 1]) .'&amp;imgw='. $imgwbig .'&amp;imgh='. $imghbig .'"';
+            $displayimage .= '<a href="'. $modulepath .'/image.php?imgp='. base64_encode($gallerypath .'/'. $retval[$poct - 1]) .'&amp;imgw='. $imgwbig .'&amp;imgh='. $imghbig .'"';
           #}
 
           switch ($overbrowser) {
@@ -495,7 +498,7 @@
           }
           $displayimage .= '>';
           # width="' . $imgw . '"
-          $displayimage .= '<img style="border: 0; margin:0px; padding:0px;" alt="" src="'. $modulepath .'/image.php?imgp='. base64_encode($absolpath . $path_middle .'/'. $retval[$poct - 1]) .'&amp;imgw='. $imgw .'&amp;imgh='. $imgh .'" />';
+          $displayimage .= '<img style="border: 0; margin:0px; padding:0px;" alt="" src="'. $modulepath .'/image.php?imgp='. base64_encode($gallerypath .'/'. $retval[$poct - 1]) .'&amp;imgw='. $imgw .'&amp;imgh='. $imgh .'" />';
           $displayimage .= '</a>';
         }
         else {
@@ -684,11 +707,7 @@
     #drupal_set_message(t('absol: '.$absolpath));
   }
   else {
-    $rp = file_directory_path();
-    if ($galleryfolder <> '') {
-      $rp .= '/'. $galleryfolder;
-    }
-    $absolpath = realpath($rp);
+    $absolpath = '/'. $galleryfolder;
   }
   #$result .= $absolpath;
 