How to retrieve all your images from your WordPress.com blog

Now I love Wordpress, and Wordpress.com is a great service. But since Wordpress.com does not allow advertising to be placed on one's precious blog, there may come a time in a young blogger's life where they want to get their own host, and their own Wordpress installation.


I'm not going to cover setting up the hosting because there are many, many hosts who can set you up cheaply with a domain, a 1-click Wordpress installation, and have you on your way to blogging for a living in under an hour. One such host would be Dreamhost. To get your fabulous blog set up with them, just head over to Dreamhost and use the promo code NEWBLOG2008 when signing up. See end of post for details on the promo code. The great thing about Dreamhost for new bloggers is that their install of Wordpress really is one click - much easier than many other hosts.

Anyway about how to grab the images from Wordpress to bring them over. To do this you will need shell access to your webhost. So, once you've got your hosting sorted out, set up your new domain and site. Get Wordpress installed under your new domain.

Now ssh into your shell account.
Go to the directory where your photos will be installed, .e.g. yourblog.com/wp-content/ or yourblog.com/wp-content/images/ (replace yourblog.com with your actual blog domain directory on your host.)

Type in this command:

wget -A.png -e robots=off -E -H -p -Dyouroldwpblog.files.wordpress.com,youroldwpblog.wordpress.com --random-wait -r -l inf http://youroldwpblog.wordpress.com

- Replace
youroldwpblog with your Wordpress.com blog name
- If your images are not in png format, change the first parameter -A.png to -A.jpg, -A.gif or whatever format they are in.

Hit enter and wget will do it's thing. It will take a few minutes depending on how many images you have on your blog and how fast your connection is.

When wget has finished, type ls, and you will see that it has created two directories, one for the Wordpress image hosting domain, e.g. youroldwpblog.files.wordpress.com and one for your actual Wordpress.com domain, e.g.
youroldwpblog.wordpress.com.

If you were using a custom permalink structure then it will have placed the images in directories based on this, e.g. 2008/03/25/catname/image1.png

So, to get them where you need them (
e.g. yourblog.com/wp-content/images/) you will now need to go into this directory and move the images back up to where you want them.

To do this:

It is likely that all the images will be stored under the Wordpress file hosting domain directory:

cd
youroldwpblog.files.wordpress.com

(if you have category directories)
cd /2008/03/

mv image*png ~/yourblog.com/wp-content/images/

That's all! Now you can reference your images in your new blog posts by using a url like: http://yourblog.com/wp-content/images/image1.png

If you need help with this, feel free to contact me in the comments.


Details about the exclusive RandomTech Dreamhost promo:

This promo code gets you:
- 1 year of hosting for $50 off the regular price - total cost for 1 year = $69.40
- 500GB disk space (that is a lot for a blog!) and increases by 2GB each week
- 5TB (yes Terrabytes!) of bandwidth per month, and increases by 40MB each week
- 1 free domain registration with domain privacy
- Unlimited email accounts and access to Webmail/POP/IMAP/SMTP with built-in spam filtering
- Unlimited hosted domains/subdomains
- Easy install of Joomla, Wordpress, Zencart, and more
- A great, easy to use control panel
- 24 hour tech support

There is even a 97 day money back guarantee - no questions asked.

Tech stuff:
- PHP4 and 5, Ruby on Rails (with Mongrel hosting!),
- Unlimited MySQL databases
- Unlimited FTP/Shell users

So give it a try now - you can use it for 3 months and then decide it's not for you - that's a no risk trial! Remember that promo code is NEWBLOG2008

No comments:

Post a Comment