--- imagefield_import.module.ori	2010-10-11 17:04:20.000000000 +0200
+++ imagefield_import.module	2010-10-14 11:27:43.000000000 +0200
@@ -659,6 +659,32 @@ function _imagefield_import_batch_proces
     // make sure that the directory exists
     $directory = filefield_widget_file_path($field);
     field_file_check_directory($directory, FILE_CREATE_DIRECTORY);
+    /* 2010/10/11 patch matteo geco: transliterate file name and phyiscally rename the file */
+    if (module_exists('transliteration')) {
+      // Transliterate the file to be imported
+      // path (relative to base_path) of the directory containing the files to import
+      $imagefield_import_path = variable_get('imagefield_import_path', file_directory_path() .'/images/import');
+      // extract the filename of the file to rename
+      $search = $imagefield_import_path . '/';
+      $origname = str_replace($search, '', $filepath);
+      require_once (drupal_get_path('module', 'transliteration') . '/transliteration.inc');
+      if (function_exists('transliteration_clean_filename')) {
+        // transliterated filename
+        $transliterated = transliteration_clean_filename($origname, language_default('language'));
+        if ($transliterated != $origname) {
+          // rename the file to be imported with transliterated filename
+          $document_root = rtrim($_SERVER['DOCUMENT_ROOT'], '/');
+          // absolute path of the file to rename
+          $oldname =  $document_root . base_path() . $filepath;
+          // new absolute path
+          $newname = file_check_location($imagefield_import_path .'/'. $transliterated, $imagefield_import_path);
+          if (rename($oldname, $newname)) {
+              $filepath = $newname;
+          }
+        }
+      }
+    }
+    /* end patch */
 
     // save the file and add it to the node
     if ($file = field_file_save_file($filepath, $validators, $directory)) {
