Note that there are some explanatory texts on larger screens.

plurals
  1. POMigrating Wordpress Images to Drupal with Migrate 2.4
    primarykey
    data
    text
    <p>I'm having a time migrating images from Wordpress to Drupal with the Migrate 2.4 module. Here are my mappings:</p> <pre><code>$this-&gt;addFieldMapping('field_image','images'); $this-&gt;addFieldMapping('destination_file', 'images'); $this-&gt;addFieldMapping('field_image:source_dir') -&gt;defaultValue('/Users/grafa/htdocs/wordpress/wp-content/uploads'); $this-&gt;addFieldMapping('field_image:file_class') -&gt;defaultValue('MigrateFileUri'); </code></pre> <p>The images come from a function that queries the wp_postmeta table then returns the result to the prepareRow() function.</p> <pre><code>function getImages($row) { $post_id = $row-&gt;id; $results = db_query(" SELECT pm.post_id, pm.meta_key, pm.meta_value FROM streetroots_wp.wp_postmeta AS pm LEFT JOIN streetroots_wp.wp_posts AS p ON pm.post_id=p.id WHERE p.post_parent = $post_id AND pm.meta_key='_wp_attached_file';"); $images = array(); foreach($results as $result) { $images[] = $result-&gt;meta_value; } return !empty($images) ? $images : NULL; } </code></pre> <p>This basically returns the image name and relative path from the wp_postmeta table something like '2012/05/figure1.jpg'. I then use prepareRow() like this:</p> <pre><code> function prepareRow($row) { $row-&gt;images = $this-&gt;getImages($row); } </code></pre> <p>I'm guessing there's something funky with how I'm using the new-ish migrate module that handles the file fields. The sql is outputs the file names correctly but it doesn't seem like the images are getting copied over. This is a Drupal 7 using Migrate 2.4. Any help is appreciated. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload