--- image_import.module.orig	2007-07-24 12:33:42.000000000 -0500
+++ image_import.module	2008-04-23 20:27:41.000000000 -0500
@@ -89,6 +89,20 @@ function image_import_form() {
     foreach ($files as $file) {
       $info = image_get_info($file->filename);
       if ($info && isset($info['extension'])) {
+        $imgtitle = basename($file->name);
+        $imgbody = ""; 
+        if ( function_exists("exif_read_data")) {
+           $exifcomment = "";
+           $imgdata = exif_read_data($file->filename, "COMMENT");
+           if (isset($imgdata[COMMENT])) {
+              foreach($imgdata[COMMENT] as $comment) {
+                 $exifcomment .= $comment . " ";
+              }
+           }
+           $imgbody = $exifcomment;
+           $imgtitle = strip_tags(trim(substr($exifcomment,0,25)));
+           $imgtitle = ( $imgtitle ? $imgtitle . "..." : basename($file->name) );
+        }
         $filelist[] = substr($file->filename, strlen($dirpath) + 1);
         $form['files']['filesize'][] = array(
           '#type' => 'item',
@@ -101,11 +115,12 @@ function image_import_form() {
         $form['files']['title'][] = array(
           '#type' => 'textfield',
           '#size' => 20,
-          '#default_value' => basename($file->name),
+          '#default_value' =>  $imgtitle,
         );
         $form['files']['body'][] = array(
           '#type' => 'textfield',
           '#size' => 20,
+          '#value' => $imgbody,
         );
       }
     }
