Fix for Fix for Fix for Image Field Import

  1. // get the field and its validators
  2.  
  3. $field = content_fields('field_bilder', 'INHALTSTYP');
  4.  
  5. $validators = filefield_widget_upload_validators($field);
  6.  
  7.  
  8. // make sure that the directory exists
  9.  
  10. $directory = filefield_widget_file_path($field);
  11.  
  12. field_file_check_directory($directory, FILE_CREATE_DIRECTORY);
  13.  
  14. if ($row['avatar']) {
  15.         $path = 'files/old/joomla/images/comprofiler/' . $row['avatar'];
  16.         $temp_image = field_file_save_file($path, $validators, $directory);
  17.         $temp_image['status'] = FILE_STATUS_PERMANENT;
  18.         $temp_image['list'] = 1;
  19.         $temp_image['uid'] = $account->uid;
  20.         $temp_image['data'] = array ('description' => '', 'alt' => ' ', 'title' =>
  21.  '');
  22.         $node_profile->field_sw_usrp_image[0] = $temp_image;
  23.  
  24.       print_r($node_profile);
  25.       die();
  26.       }

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.