How to Migrate Blog Post Images from BlogEngine to WordPress

I recently migrated my entire blog to a new host and a new blogging platform. While doing the transition, I took notes, analyzed my options and made the jump from BlogEngine to WordPress just last weekend. This post addresses one problem I encountered along the way.

One problem I encountered while performing migration tests from BlogEngine to WordPress were the image references in the posts. Left unaccounted for, any post images on WordPress after the migration will be using a reference that was good for BlogEngine but fails for WordPress. So something needs to be done to them unless you don’t mind redoing each and every post that contains an image in it. I know I don’t want to waste that time, so here’s how I worked around this little problem.

The Problem

In BlogEngine image references look like this:

domainname/image.axd?picture=WindowsLiveWriter/some-folder/some-image.jpg

In WordPress, an image reference looks like this:

domainname/wp-content/uploads/2009/06/some-image.jpg

After you migrate your blog from BlogEngine to WordPress using the BlogML import tool in WordPress, all images will be referring to image.axd and not wp-content. So how can we fix this problem? Easy, we need to modify the BlogML data file before we upload it into WordPress. So let’s have some fun and perform a little string surgery.

The Solution

There’s an easy fix for this, and all it requires is identifying where the physical images are and modifying the references in the BlogML data file.

BlogEngine stores the image files for posts within the App_Data\Files folder. I happen to use Windows Live Writer, so all of my images went even further into another folder. So why am I explaining all this?

These files will need to be FTP’d to the destination host and placed under your /wp-content/uploads/ folder. You can move these ahead of time and have them sitting there waiting for you to perform the import process. Just grab the root-most folder that contains the images and move them over to the new host.

Once the files are on the new host, give one a test to make sure that you can still access the images you want. Just type in a direct reference like http://www.waynejohn.com/wp-content/blah blah/someimage.jpg into a browser, and it should come up if everything is alright.

Plus, once you have the image reference in the browser, you can refer to it while performing a quick find/replace operation in your favorite text editor. If the domain name is changing, include a quick sweep for your domain name also, as part of the string surgery. Just in case. You never know.

Here are the steps to migrate your BlogEngine post images to a WordPress blog.

  • Find the root image folder and FTP the folder and all it’s contents to the /wp-content/uploads/ folder.
  • In the BlogML data file, replace all instances of “/image.axd?picture=” with “/wp-content/uploads/” in the BlogML file.
  • Perform any other string manipulation operations you’d like to perform in the BlogML data file.
  • Import the BlogML data file to WordPress

That’s all there is to it. At this point you should be able to view your WordPress blog and see that the post images are indeed there and they are pointing to a reference located on your WordPress host. Everything should be looking good, as far as post images are concerned.

If you see any way to make this more effective or easier, let me know. Unfortunately the BlogML does not include the code it would need to migrate the images. At least not that I was able to discern, but I didn’t go digging in it either. Perhaps the process would add too much overhead, but I’m sure there are ways around that.

It would make things so much more easy, and this post completely unnecessary. So I guess I should just keep my trap shut.


You might also enjoy these related posts

  1. Updated BlogML Import Class for WordPress When you export all your post data from BlogEngine and try to import the data file into WordPress using Aaron Lerch’s BlogML import class, I found that it does...
  2. WayneJohn.com is Migrating From BlogEngine to WordPress Sometime this week I’m migrating this blog from BlogEngine to WordPress. It’s been given a lot of thought, and I’ve spent many hours pondering the pro’s and con’s of...
  3. Why I Decided To Migrate to WordPress I recently announced that I'm migrating my blog over to WordPress, and I thought that there might be some benefit to others if I explained how I reached this...
  4. The Migration to WordPress is Complete Over the weekend I followed through on my plan to migrate my blog over to WordPress.  My migration is now complete, for the most part. I spent most of...
  5. Removing the “An automated WordPress update has failed to complete” message I recently upgraded my install of WordPress here on WayneJohn.com, but I did it through the WordPress interface, and not the “One click install” interface on Dreamhost.  One thing...

About the Author

Wayne John is a web developer in Southern California that shares his 25+ years of programming and web development experience freely and happily to anyone willing to learn. He also loathes speaking in the third person. If you enjoyed this post, make sure you subscribe to my RSS feed or get updates in your email.