--- imagebrowser.module	2008-10-30 00:16:50.000000000 +0100
+++ imagebrowser.module.patch	2008-11-02 13:31:18.000000000 +0100
@@ -136,14 +136,14 @@ function imagebrowser_browser(){
   //Make a nice header for the pop-up window, real nice like
   $output = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
   <html><head><title>Image Browser</title>
-  <link type="text/css" rel="stylesheet" media="all" href="/modules/system/defaults.css" />
-  <link type="text/css" rel="stylesheet" media="all" href="/modules/system/system.css" />
-  <link type="text/css" rel="stylesheet" media="all" href="/themes/garland/style.css" />
-  <link type="text/css" rel="stylesheet" media="all" href="/'.drupal_get_path('module', 'imagebrowser').'/imagebrowser.css" />
-  <script type="text/javascript" src="/misc/jquery.js"></script>
-  <script type="text/javascript" src="/misc/drupal.js"></script>
-  <script type="text/javascript" src="/'.drupal_get_path('module', 'imagebrowser').'/imagebrowser.js"></script>
-  </head><body><h2 class="title">Image Browser</h2>';
+  <link type="text/css" rel="stylesheet" media="all" href="'.base_path().'modules/system/defaults.css" />
+  <link type="text/css" rel="stylesheet" media="all" href="'.base_path().'modules/system/system.css" />
+  <link type="text/css" rel="stylesheet" media="all" href="'.base_path().'themes/garland/style.css" />
+  <link type="text/css" rel="stylesheet" media="all" href="'.base_path().drupal_get_path('module', 'imagebrowser').'/imagebrowser.css" />
+  <script type="text/javascript" src="'.base_path().'misc/jquery.js"></script>
+  <script type="text/javascript" src="'.base_path().'misc/drupal.js"></script>
+  <script type="text/javascript" src="'.base_path().drupal_get_path('module', 'imagebrowser').'/imagebrowser.js"></script>
+ </head><body><h2 class="title">Image Browser</h2>';
   
   //Only display upload form if they have permissions
   if (user_access('upload images') && user_access('create images')) {
@@ -229,8 +229,14 @@ function imagebrowser_browser_images($fi
   //Lets generate it
   $output = '<ul class="images">';
   while ($image = db_fetch_object($result)) {
-    $output .= '<li><a href="/imagebrowser/load/imagedetails/'.$image->nid.'"><img src="/imagebrowser/view/image/'.$image->nid.'/thumbnail" alt="'.$image->title.'"/></a></li>';
-  }
+  
+  $preset_size = "thumbnail"; // Change to a load var preset in the future?
+  
+  $file = new stdClass();
+  $file->fid =  db_result(db_query("SELECT fid FROM {image} WHERE nid = '%s' AND image_size='%s'", $image->nid, $preset_size));
+  $file->filepath = db_result(db_query("SELECT filepath FROM {files} WHERE fid = '%s' AND filename='%s'", $file->fid, $preset_size));
+  
+  $output .= '<li><a href="'.base_path().drupal_get_path('module', 'imagebrowser').'/load/imagedetails/'.$image->nid.'"><img src="'.base_path().$file->filepath.'" alt="'.$image->title.'"/></a></li>'; }
   $output .= '</ul>';
   $output .= theme("pager", NULL, 8);
   print $output;
@@ -257,7 +263,15 @@ function imagebrowser_browser_imagedetai
     
     if(in_array('thumbnail', $display, true)) {
       $margin = ' with-thumbnail';
-      $output2 = '<div class="image"><img src="/image/view/'.$nid.'/thumbnail" alt="Thumbnail" /></div>';
+      
+      $preset_size = "thumbnail"; // Change to a load var preset in the future?
+  
+  	  $file = new stdClass();
+  	  $file->fid =  db_result(db_query("SELECT fid FROM {image} WHERE nid = '%s' AND image_size='%s'", $image->nid, $preset_size));
+ 	  $file->filepath = db_result(db_query("SELECT filepath FROM {files} WHERE fid = '%s' AND filename='%s'", $file->fid, $preset_size));
+
+      
+      $output2 = '<div class="image"><img src="'.base_path().$file->filepath.'" alt="Thumbnail" /></div>';
     } else {
       $margin = null;
       $output2 =null;
@@ -309,7 +323,7 @@ function imagebrowser_browser_imagedetai
       $row[] = t($size['width'].' x '.$size['height']);
       
       if(variable_get('imagebrowser_insert_type', 'dynamic') == 'dynamic') {
-        $row[] = '<a href="javascript:SelectFile(\'/imagebrowser/view/image/'.$nid.'/'.strtolower($size['label']).'\', \'\', \'\', \''.$node->title.'\');">Insert</a>';
+        $row[] = '<a href="javascript:SelectFile(\''.base_path().drupal_get_path_alias('/view/image/'.$nid.'/'.strtolower($size['label'])).'\', \'\', \'\', \''.$node->title.'\');">Insert</a>';
       }else{
         $label = strtolower($size['label']);
         $row[] = '<a href="javascript:SelectFile(\'/'.$node->images[$label].'\', \'\', \'\', \''.$node->title.'\');">Insert</a>';
@@ -330,7 +344,7 @@ function imagebrowser_browser_imagedetai
         $row[] = t('~');
         
         if(variable_get('imagebrowser_insert_type', 'dynamic') == 'dynamic') {
-          $row[] = '<a href="javascript:SelectFile(\'/imagebrowser/view/imagecache/'. $nid.'/'.$preset['presetname'].'\',\'\',\'\',\'\');">Insert</a>';
+          $row[] = '<a href="javascript:SelectFile(\''.base_path().drupal_get_path_alias('/view/imagecache/'. $nid.'/'.$preset['presetname']).'\',\'\',\'\',\'\');">Insert</a>';
         }else{
           $path = imagecache_create_path($preset['presetname'], $node->images['_original']);
           $row[] = '<a href="javascript:SelectFile(\'/'.$path.'\',\'\',\'\',\'\');">Insert</a>';
