1

I am attempting to migrate images from a directory into an image field. All of my other fields are migrating correctly. No errors are being thrown, the database values do not appear and the image is not copied into the destination directory.

// Image migration
// basic mapping of destination field and source field
$this->addFieldMapping('field_figurae_image', 'highresfile');
// Directory where source images are located
$this->addFieldMapping('field_figurae_image:source_dir')
     ->defaultValue(drupal_get_path('module', 'migrate') . '/matrixmigrate/matrix_libary');
// Directory that source images will be copied to
$this->addFieldMapping('field_figurae_image:destination_dir')
     ->defaultValue('sites/default/files');

I believe my syntax is at least close to correct here. It is based on the "BeerNodeMigration" example. I had difficulty with Taxonomy migration that had very similar results. It turned out that I had another piece of code that was not formatted correctly. This is the only code I have related to images, is there an additional step that I'm missing?

Thank you for your time.

-Mitchell

1

I think my source_dir path was incorrect. I used the following and it worked:

// Image migration
// basic mapping of destination field and source field
$this->addFieldMapping('field_figurae_image', 'highresfile');
// Directory where source images are located
$this->addFieldMapping('field_figurae_image:source_dir')
     ->defaultValue(drupal_get_path('module', 'matrixmigrate') . '/matrix_library');

The major difference here is that I used my sub-module instead of the migrate module itself to grab the path. I also played with permissions in various directories. I think one of those two things did it. I also dropped the destination directory since it defaults to your Drupal file directory.

  • /Matrix_library, is that for your source images, or is that the new path? – Vic Feb 26 '13 at 4:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.