Bulk Image Downloader for WordPress Users

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#.

Executable : WpBulkDownloader-Alpha-Executable.zip
SourceCode : WpBulkDownloader.zip

Contents

  • Introduction
  • Background
  • Software Requirements
  • How to use
  • How it works
  • FAQ

Introduction

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.

WP Bulk Image Downloader (Alpha) for WordPress Users

Background

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.

Software Requirements

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.

WP Bulk Image Downloader - Options

  • 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.

FAQs

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.

75 thoughts on “Bulk Image Downloader for WordPress Users

  1. Hi Peter, I didn’t receive your email. I will forward you the email that I sent to BretG. Please help to test and let me know if it solves the problem or not.

  2. Hi Michael Sync and all,

    I had to write a bulk downloader as well to migrate my blogs, but this will download all files in the media library of your blog and it has installers for Debian based operating systems only.

    I hope you don’t mind me sharing it here for people who do not use Windows:

    http://wpgetmedia.rtfd.org/

    Hope it helps.

  3. Hi Michael,

    I am using your WP Bulk Image Downloader (Alpha) and i have been waiting for 10 minutes and its show no photos for me to donwload. I have disabled the two way authentication,

    Is there anyway i can workaround to get my photos back ? Im using free wordpress.com.

    Hope to hear from you soon.

  4. Hi Keanlow, Sure. I will upload the build that I shared with Peter.. but I didn’t hear any update from him yet so I am not sure if new build works for him or not. If I got some time, I will look at it again on improving it.. but for now, I can share new build with you.

  5. Michael, I’d also appreciate a copy of the new build to try out. Happy to provide feedback after I’ve tried it. (Have two wp.com sites to try it on.)

    Really appreciate you sticking with this project after so many years!

    Paul

  6. Hi Kean and Paul,

    I re-compiled the existing code with .NET 4 and uploaded both exe and source to github.

    You can download them from here https://github.com/michaelsync/Michael-Sync-s-blog-sample/tree/master/Wp-Downloader

    If you have Visual Studio 2012, you can use the source code to run the program.

    If you are not a coder then you can just try the exe. Enter the user name and password in setting and start the download..

    Note that Wordpess doesn’t support the REST api at that time so I was using XPC in the program..

    Let me know.. I would love to re-write it but I have very limited time .. hope I will re-write it soon.

  7. If it doesn’t work then let me know the version of wordpress you are using. If you have the exported XML sample then I can import it locally to test it.

  8. Hi Michael,

    I am still unable to access using the WPDownloader. Below are the error i encountered. I am not an programmer so i am not sure whati s the issue.

    I appreciate if you can help on the below error.

    Thanks a million,

    Kean Low

    See the end of this message for details on invoking
    just-in-time (JIT) debugging instead of this dialog box.

    ************** Exception Text **************
    System.UriFormatException: Invalid URI: The format of the URI could not be determined.
    at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
    at System.Uri..ctor(String uriString)
    at CookComputing.XmlRpc.XmlRpcClientProtocol.Invoke(Object clientObj, MethodInfo mi, Object[] parameters)
    at CookComputing.XmlRpc.XmlRpcClientProtocol.Invoke(Object clientObj, String methodName, Object[] parameters)
    at CookComputing.XmlRpc.XmlRpcClientProtocol.Invoke(String MethodName, Object[] Parameters)
    at WpBulkDownloader.MetaWeblog.getRecentPosts(String blogid, String username, String password, Int32 numberOfPosts) in c:\Users\Michael\Downloads\WpBulkDownloader – Alpha\WpBulkDownloader\Source\WpBulkDownloader\MetaWeblogAPI.cs:line 89
    at WpBulkDownloader.MainForm.getPosts() in c:\Users\Michael\Downloads\WpBulkDownloader – Alpha\WpBulkDownloader\Source\WpBulkDownloader\MainForm.cs:line 35
    at WpBulkDownloader.MainForm.startButton_Click(Object sender, EventArgs e) in c:\Users\Michael\Downloads\WpBulkDownloader – Alpha\WpBulkDownloader\Source\WpBulkDownloader\MainForm.cs:line 112
    at System.Windows.Forms.Control.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.ButtonBase.WndProc(Message& m)
    at System.Windows.Forms.Button.WndProc(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    ************** Loaded Assemblies **************
    mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5466 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
    —————————————-
    WpBulkDownloader
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/kelow/Downloads/executable-bin/executable/WpBulkDownloader.exe
    —————————————-
    System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5468 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    —————————————-
    System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5467 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
    —————————————-
    System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5467 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    —————————————-
    System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5476 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
    —————————————-
    PresentationFramework
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.6920.5453 built by: Win7SP1GDR
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/PresentationFramework/3.0.0.0__31bf3856ad364e35/PresentationFramework.dll
    —————————————-
    WindowsBase
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.6920.5453 built by: Win7SP1GDR
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/WindowsBase/3.0.0.0__31bf3856ad364e35/WindowsBase.dll
    —————————————-
    PresentationCore
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.6920.5453 built by: Win7SP1GDR
    CodeBase: file:///C:/Windows/assembly/GAC_32/PresentationCore/3.0.0.0__31bf3856ad364e35/PresentationCore.dll
    —————————————-
    System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5476 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
    —————————————-
    CookComputing.XmlRpcV2
    Assembly Version: 0.0.0.0
    Win32 Version: 0.0.0.0
    CodeBase: file:///C:/Users/kelow/Downloads/executable-bin/executable/CookComputing.XmlRpcV2.DLL
    —————————————-

    ************** JIT Debugging **************
    To enable just-in-time (JIT) debugging, the .config file for this
    application or computer (machine.config) must have the
    jitDebugging value set in the system.windows.forms section.
    The application must also be compiled with debugging
    enabled.

    For example:

    When JIT debugging is enabled, any unhandled exception
    will be sent to the JIT debugger registered on the computer
    rather than be handled by this dialog box.

  9. This works great for some images, but I’ve noticed that most of the images URLs found by the utility include a query string at the end, such as http:/site.com/2014/01/image.jpg?w=640

    Then once you try to download those images, none that included the query string get downloaded.. Only images that didn’t have a query string in the returned URL actually get saved.

    Any ideas?

  10. Thank you Michael for providing the source!

    @Greg we ran into the same problem too…
    I fixed our issue by updating the regular expression used in the source.

    In file MainForm.cs look for
    string ftr = @”…”

    Repace with your regular expression.

    Recompile in Visual Studio Express 2012 for Windows Desktop.

    Note: you may need to update the regex to hand more images if you are expecting different ones.

  11. Any chance this has been updated recently? I can get it to connect to my site, but it only downloads the most recent month/year post folder images, nothing else.

  12. Thank you, Michael. Your professionalism radiates from how you have been managing this project. And, thank you for making something so useful available, as you did.

    ~Tanya

  13. Каждому крымская косметика! крымская натуральна косметика – Крымская роза , Царство ароматов , Дом природы , Алуштенский эфиромаслечный завод +79780250557 +79787413892 отпом и в розницу http://krymcosmetics.ru шампуни , крема , гель , мыло натуральное.

Leave a Reply

Your email address will not be published. Required fields are marked *