Skip to content

Handle images embedded in post content #19

mdb opened this Issue Jan 13, 2014 · 3 comments

3 participants

mdb commented Jan 13, 2014

It would be great if wp2mm could handle images embedded in post content.

For example, the migrator could download Wordpress media library images referenced in post content to an 'export/images' directory and appropriately tweak each image's 'src' value in the post content to reference its new 'images/*' location.


I'm working on this (but don't let that prevent others from trying to tackle it). I think the convention (possibly a requirement) is that if a post is named 2014-14-01-my-post.html.markdown that its content goes into a directory named 2014-14-01-my-post.

Wordpress often embeds a scaled version of the image, so I'm working on grabbing the full-sized image out of the wp-uploads directory... though this necessitates then having a dependency like middleman-thumbnailer. So my approach might be overly obsessive in preserving the fullsize original images.

Regardless of what I wrote above, we should probably rewrite the image tag to use middleman's file helper so that the asset_hash works properly. Whew!


@bensheldon downloading wp images looks interesting. Have you made any progress on it? I'd like to help, but need a little more information.


@natedavisolds so, I ended up just brute-forcing the files along with an (unpublished) utility gem I put together for reading and writing out markdown+frontmatter files:

Here is my collection of utility scripts:

Long story short, it wasn't a very clean process (though my blog has had a couple of lives as it was a Drupal website before I converted it to Wordpress before I converted it to Middleman). But it worked after a lot of finagling. So it may be a challenge to automate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.