Migrating images and files are similar. Check this:
Migrate Contents from Drupal 6 to Drupal 7 Using Migrate 2
Here's the pieces of code for images and files migration. You can put it in your migration class and remember to change the database name, field names, urls to yours.
<?php
// Add other source fields which may be populated in prepareRow()
$source_fields = array(
'image_filename' => t('img_filename'),
'attachments_filename' => t('attachments_filename'),
'attachments_filepath' => t('attachments_filepath'),
'attachments_description' => t('attachments_description'),
);
// Create a MigrateSource object, which manages retrieving the input data.
$this->source = new MigrateSourceSQL($query, $source_fields);
$this->addFieldMapping('field_image', 'image_filename');
$this->addFieldMapping('field_image:source_dir')->defaultValue('http://DOMAINNAME.COM/sites/default/files/THE_DIR_YOU_PUT_IMAGES');
$this->addFieldMapping('field_attachments', 'field_attachments');
$this->addFieldMapping('field_attachments:source_dir', 'field_attachments_filepath');
$this->addFieldMapping('field_attachments:description', 'field_attachments_description');
public function prepareRow($current_row) {
// Set image data for the image fields.
$query = db_select(SOURCE_DATABASE . '.content_type_NAME', 'i')
->condition('i.vid', $current_row->vid, '=');
$query->join(SOURCE_DATABASE . '.files', 'f', 'i.field_image_fid = f.fid');
$query->addField('f', 'filename');
$result = $query->execute();
foreach ($result as $row) {
$image = array(
'filename' => $row->filename,
);
$current_row->image_filename = $image['filename'];
}
// Set file data for the attachment file fields.
$query = db_select(SOURCE_DATABASE . '.content_field_attachment', 'a')
->fields('a', array('field_attachment_data'))
->condition('a.vid', $current_row->vid, '=');
$query->join(SOURCE_DATABASE . '.files', 'f', 'a.field_attachment_fid = f.fid');
$query->addField('f', 'filename');
$query->addField('f', 'filepath');
$query->orderBy('a.field_attachment_fid', 'ASC');
$result = $query->execute();
foreach ($result as $row) {
$field_data = unserialize($row->field_attachment_data);
$field = array(
'filename' => $row->filename,
'filepath' => str_replace($row->filename, '', $row->filepath),
'description' => $field_data['description'],
);
$current_row->attachments_filename[] = $field['filename'];
$current_row->attachments_filepath[] = 'http://DOMAINNAME.COM/' . $field['filepath'];
$current_row->attachments_description[] = $field['description'];
}
}
?>