Wordpress: Migrating your blog to another server and/or domain


I've been putting this one off for a while because it seemed horribly tedious, but it's so awesome to find a plugin that does ALL the hard work for you.

I didn't need to upload my database onto another site to perform any string replacements. I didn't have to download the Wordpress installation package and set it up and import data. I didn't have to even log in as admin to back up MySQL or the FTP files.

I am honestly amazed at how easy this process is due to the plugin. It simply just works.

It's so beautiful.

What you'll need

  • An existing Wordpress powered blog (Latest version at time of writing is v3.9.1)
  • Duplicator plugin for Wordpress (v0.5.6 at time of writing)
  • A new host/domain to host your new blog
  • About 15 minutes (not including time to download and upload the backup archive)

In Wordpress

  • Log into your admin and then go to Plugins
  • Add New
  • Search for "Duplicator" and install it
  • Once done, activate the plugin


There should now be a new "Duplicator" menu in your admin. Click on it.

  • "Create new" to create a new backup
  • Default settings are perfect, just click "Next" (unless you really needed to tweak something)
  • Let the scan do it's thing.
  • Check for any warnings or errors
  • (optional) Remove error_log files in ~/ or ~/wp-admin/ if they're too big or not worth keeping
  • Click build
  • And now wait...
  • Download the installer file
  • Download the archive (zip) from browser (or ftp in ~/wp-snapshots/). This is the second longest step in the process.


I'm assuming you've done this already, but these are the generic steps. No help from me here.

  • Set up an account on your web host
  • (if needed) Point your new domain to that server
  • Make sure it has PHP and MySQL up and running
  • Set up a database for Wordpress
  • Set up FTP access so you can upload the backup archive and installer.php


  • Upload "installer.php" and your backup archive to the new server in ~/public_html/

This is the longest step in the whole process :(


  • In your browser of choice, go to http://yoursite.com/installer.php
  • Make sure it passes all the tests
  • Enter in the new database settings
  • Test connection to see if the database settings are OK to use
  • Click deploy


  • Make sure the new domain settings and file locations are correct
  • Make sure the right plugins are activated
  • (optional) Keep post GUIDs the same if you're using RSS for anything like automated sharing to Facebook or Twitter to avoid reposts
  • Click update
  • Check any errors or warnings.
  • Now you're all done! Celebrate on your success!

Celebrating, Nicolas Cage style!

Wordpress Admin

A few last steps to tidy things up.

  • Log in to /wp-admin
  • There should be a notification saying that the Duplicator files are still hanging around. Remove them.
  • Disable the plugin
  • Try writing a draft post and attacking an image.
  • Donate to Cory Lamle, the author of Duplicator. He deserves it.

Python: Reading EXIF and IPTC tags from JPG/TIFF image files


Wow this was a bit of an "antigravity" moment for me (XKCD #353).

All I really needed to do was choose my poison:

  • Pillow (an actively maintained PIL fork which unofficially supports basic EXIF tag reading)
  • ExifRead (EXIF reader) v1.4.2 at time of writing
  • IPTCInfo (IPTC reader) v1.9.5-6 at time of writing


I'd just like to point out some things I learned the hard way.

  • If something isn't showing up in the EXIF tag data, then it's most likely saved as IPTC metadata (like title, subject and tags/comments in the screenshot below).
  • The fields XPTitle, XPComment, XPAuthor, XPKeywords and XPSubject are encoded in UCS2 (UTF-16). This will need to be converted, unless you like dealing with hex strings or byte arrays.
  • Combining an EXIF and IPTC method together will be your best way of extracting metadata from the file.



Using Pillow

This one reads some of the basic EXIF data but tended to be a bit clunky to use.

Helper function:

And to use it, simply pass in the values from Image._getexif(). The helper function convert_exif_to_dict() will make it easier for you to read information off, rather than referring to data by ID.

Would I recommend it? Probably not. ExifRead below is a much better candidate.

Using ExifRead

This alternative to using PIL can extract much more information and also makes it easier to fetch information, but it also does require you to install another library.

As you can see, this one is much cleaner to use, except for the weird problem where you have to access exif['something'].values instead of exif['something'].

It's not gonna ruin your day, but I guess you could write a helper function for it if it really bothered you.

There's also another bit in the snippet where I use join/map/unichr. That's because the values for those fields need to be converted from an array of bytes to a string which Python can understand.

Using IPTCInfo

Lastly there's IPTC, which I've NEVER heard of until I started trying to pull metadata from JPG/TIFF files. This was my antigravity moment where I just looked for a library, installed it and "it just works".

Sadly, it feels a little bit like a Java developer wrote it. Mainly because of little things like iptc.getData() where you can just use iptc.data.

You'll also feel a little lost without knowing which data keys to use, so can get a list of all the possible data key names by examining:

from iptcinfo import c_datasets, c_datasets_r

Those two dictionary objects will tell you what's available so it shouldn't be too hard to write a nice little wrapper for it. These kinda feel like Java enums =\

Are you ready to handle all this big data?


Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog