I'm migrating lots of images from a Drupal 8 site into Drupal 9. I want these to be media in the Drupal 9 site.
We have used the following YAML code and are trying to migrate the images in the media field.
id: images_migration_test6
label: 'Migrate Images to Media and Files'
migration_groups:
- 'custom_migrations'
source:
plugin: embedded_data
data_rows:
- id: 1
filename: 'image1.jpg'
image_path: 'https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg'
created_at: '2022-01-26T12:00:00' # Updated to ISO 8601 format
- id: 2
filename: 'image2.jpg'
image_path: 'https://upload.wikimedia.org/wikipedia/commons/a/a3/Patras_from_the_fortress.jpg'
created_at: '2022-01-26T14:30:00' # Updated to ISO 8601 format
ids:
id:
type: integer
process:
bundle:
plugin: default_value
default_value: 'image' # Media bundle type, adjust as needed
name: filename
field_media_image/target_id:
plugin: migration_lookup
migration: images_migration_file
source: image_path
status:
plugin: default_value
default_value: 1 # Published
uid:
plugin: default_value
default_value: 1 # User ID for the author of the media item
created:
plugin: format_date
from_format: 'Y-m-d\TH:i:s' # Updated to match the format in the source data
to_format: 'U'
source: created_at
# File Migration Configuration
field_media_image__file:
plugin: migration_lookup
migration: images_migration_file
source: image_path
field_media_image__alt:
plugin: default_value
default_value: 'Image Alt Text' # Adjust as needed
destination:
plugin: 'entity:media'
default_bundle: image # Media bundle type, adjust as needed
We got a success message, but the actual image is not migrating to the media field. Anybody please help on this?