A tool for downloading images from your WordPress.com blog to your local machine. It is also an example of how to use XML RPC service in C#.
- Software Requirements
- How to use
- How it works
This is a tool that helps you to download all of your images that you posted in your blog. This tool is created especially for WordPress.com users but it will support all other blogging softwares in future. You will definitely need this tool when you want to move your blog from wordpress.com to self-host.
My blog was hosted on WordPress.com last year. I had too many images uploaded in my free space. When I wanted to move my blog to self-host, I noticed that there is no way to bulk-download all of my images from WordPress account to my local disk. I didn’t want to copy each and every images manually so I wrote this tool that can scan each and every urls from my blog and create the directory based on the URL. And then, download them into my local harddisk. It’s just 2 hours program that I wrote at that time. So, I’m sure that there won’t be all features that you want in this program. But don’t worry. Just drop a comment in this post. I will add the feature that you want in next release.
How to use it?
The steps are very simple.
- Configure your blog in Bulk Image Downlader. Click “Options” and fill your blog URL, user name and password as picture below.
- Click “OK” button to save your configuration and close the dialog
- Click “Get Files” button to get the list of image URLs from your blog. (You may need to wait a few minutes while retrieving the list of images from your blog.)
- After retrieving the list of Image URL, you can click “Download” button to download the images to your local disk. (You may need to wait a few minutes while processing. )
- After that, you can check all of your images in “Downloaded Images” directory.
How does it work?
Note: This is for those who like to read the sourcecode and want an explanation about codes. If you are just a normal user, you may skip this section.
Firstly, the program will read the user name, password and blogurl from config file. It will append “xmlrpc.php” which is the standard XML RPC interface for WordPress at the end of blogurl string. Then, it will invoke getRecentPost() API of wordpress. I used opensource XML-RPC.NET library in this sample. As there is no getPosts() API in xmlrpc.php, we have to use the alternative method (getRecentPost() API) for retrieving the posts from the blog. The max number of posts is set to 1000 in the program. If you have more than 1000 posts in your blog, you probably need to change the default value.
If the authenticating is successful then we will get the list of posts from the blog. So, we have to filter the URL of images from the contents. Initially, I was thinking to filter <img> tag from the content. But there are some cases that we used big image in <A> tag and small images in <img> tag. So, I decided to filter the <img> tag and <a> tag from the contents based on the extensions (*.jpg, *.png, *.gif) by using regular expression. After that, I shows the list of URLS in ListView.
When the user clicks “Download” button, I start downloading the image one by one. (Note: I used C# downloader class which is written by Shailen Sukul in this example. ) Based on the URL, the program will create the directory accordingly. For example, If the image URL is “http://your.wp.com/2009/09/image1″ then the program will create the directories like “09″ folder under “2009″ folder under “/Downloaded Images/” folder. So, you can easily upload all of your images to your new host via FTP.
That’s all about how Bulk Image Downloader works. If you have any question, please let me know.
1. Can you make the better UI for this program?
Yes. Of course. I’m thinking to change this Windows Form to WPF version so that you will definitely get the better UI for this program.
2. The form is freeze while downloading the images. Why?
Sorry about this issue. For the time being, all processes are running in single thread so that UI will be freeze while processing. I will separate the UI and logic into different thread in next release.
3. Can I request new feature?
Yes. Of course. This is the main reason why I released it as alpha. Feel free to drop a comment in this post. I will make a list of feature requests and will be added in next version.