Fix for Fix for Image Field Import

  1.   // get the field and its validators
  2.  
  3.   $field = content_fields('field_bilder', 'modell');
  4.  
  5.   $validators = filefield_widget_upload_validators($field);
  6.  
  7.   // make sure that the directory exists
  8.  
  9.   $directory = filefield_widget_file_path($field).'bau';
  10.  
  11.   field_file_check_directory($directory, FILE_CREATE_DIRECTORY);
  12.  
  13. $scan = file_scan_directory($full, 'jpg|png|gif|JPG|PNG');
  14.  
  15. foreach($scan AS $path => $image) {
  16.  
  17.       $temp_image = field_file_save_file($path, $validators, $directory);
  18.       $temp_image['status'] = FILE_STATUS_PERMANENT;
  19.       $temp_image['list'] = 1;
  20.       $temp_image['uid'] = $uid;
  21.       $temp_image['data'] = array ('description' => $data[1], 'alt' => $data[1], 'title' => $data[1]);
  22.       $node->field_bilder[$i++] = $temp_image;
  23.       $temp_image['original_path'] = $path;
  24.       //echo $bilder;
  25. }

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.