? imagefield_array_fix.patch
Index: imagefield.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagefield/imagefield.module,v
retrieving revision 1.9.2.1
diff -u -r1.9.2.1 imagefield.module
--- imagefield.module	1 Sep 2006 22:08:32 -0000	1.9.2.1
+++ imagefield.module	11 Sep 2006 17:31:12 -0000
@@ -35,7 +35,7 @@
           $filename = file_create_filename($file['filename'], file_create_path());
           // strip file_directory_path() from private downloads path. @see file_create_url
           if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) ==  FILE_DOWNLOADS_PRIVATE) {
-            if (strpos($filename, file_directory_path()) !== false) {
+            if (strpos($filename, file_directory_path()) !== FALSE) {
               $filename = trim(substr($filename, strlen(file_directory_path())), '\\/');
             }
             $filename = 'system/files/' . $filename;
@@ -307,11 +307,11 @@
       // Attach new files 
       if ($file = file_check_upload($fieldname . '_upload')) {
         $file = (array)$file;
-        if (strpos($file['filemime'],'image') !== false) { 
+        if (strpos($file['filemime'],'image') !== FALSE) { 
           $file = _imagefield_scale_image($file, $field['widget']['max_resolution']); 
         }
         else {
-          return false;
+          return FALSE;
         }
         $file['fid'] = 'upload';
         if (!$field['multiple']) {
@@ -468,17 +468,16 @@
 
 
 function _imagefield_file_load($fid = NULL) {
-  // Exit if we were not passed an fid to load;
-  if (!isset($fid)) { 
-    return false;
-  }
-  // Test to catch fid, eventuall plan to have node_load syntax
-  // once file_attributes table is complete
-  if (is_numeric($fid)) {
-    $result = db_query('SELECT * FROM {files} WHERE fid = %d', $fid);
-    return db_fetch_array($result);
+  // Don't bother if we weren't passed and fid.
+  if (isset($fid)) { 
+    // Test to catch fid, eventuall plan to have node_load syntax
+    // once file_attributes table is complete
+    if (is_numeric($fid)) {
+      $result = db_query('SELECT * FROM {files} WHERE fid = %d', $fid);
+      return db_fetch_array($result);
+    }
   }
-  return FALSE;
+  return array();
 }
 
 function theme_imagefield_image_preview($file, $alt ='', $title='', $attributes = NULL, $getsize= TRUE) {
