1

I'm currently importing nodes from a Drupal 7 to Drupal 8 site, using this very helpful tutorial: https://www.drupal.org/docs/8/upgrade/using-the-migrate-source-csv-plugin I have found a fairly good way to import fields. My only stumbling block at the moment is images. I'm finding it very hard to find anything about how I would manage importing of images, whether if I give it the path of the old images it can import from there, or if I give it a file name, then put the image somewhere, I have tried both so far and the image field always just ends up blank in the new nodes that are created. I've got my head around using the above links approach so if anyone has a solution that fits with that, that would be great!

1 Answer 1

1

You'll need to run a migration of all the files you want first. The file_copy process plugin is going to be your best friend for this part. To get you started,

id: image_migration
destination:
  plugin: 'entity:file'
process:
  uri:
    plugin: file_copy
    source:
      - file_source_uri
      - file_destination_uri

Once you have your files migrated, it's actually very easy to tell your image field about the file

process:
  field_image:
    plugin: migration
    migration: image_migration
    source: image_id

A couple notes:

  • image_migration refers to the migration that imports your images. Make sure to change it if you use a different name.
  • image_id needs to be the key from the image migration. It will be mapped to the new file created during that import.

Very Useful Guide

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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