If you're ready to move your own Flickr photo collection to WordPress and feel comfortable on the command line, you can go straight to the Flickr to WordPress tool I built and get started.
Update on Feb 18, 2020: You can now also learn about my tool for finding/replacing old Flickr image references in your WordPress post content.
Here's some backstory:
I used to love Flickr as a place to store photos, and as a community for sharing and discussing photography. But as its ownership changed hands and its future became at times uncertain, I grew reluctant to trust that it could continue to be a permanent home for my own photos. My discomfort increased as I have become more engaged with the need to have full ownership over the things I create online.
So, I set out to migrate my 3.6GB collection of 2,481 Flickr photos, along with their tags, comments and other metadata, into a new home while I still could.
Why WordPress
As someone who works with a WordPress hammer daily I know I'm in danger of seeing every technical need as another nail to hit. But as a content management tool with advanced image handling capabilities, WordPress really is a great foundation for what is essentially photoblogging.
There are an increasing number of WordPress themes that do an excellent job of featuring collections of images. I use a modified version of Fukasawa by Anders Norén but will probably switch to his similar Koji theme soon; Photo Blog is also a good option if you're on WordPress.com. (Full disclosure, I work for Automattic, the company that operates WordPress.com.)
WordPress is doing a great job these days of displaying just the right image size for just the right mobile or desktop viewing scenario, and so things like responsive design and good image performance mostly come out of the box.
The free WordPress mobile app makes it pretty straightforward to get a photo you've just taken on your iOS or Android smartphone into a WordPress instance. On my iPhone it has a share extension so I can do it right from the Photos app.
Most importantly, I know that putting my photos in WordPress means I have ultimate portability for the future. I can keep them on my self-hosted WordPress site now and move them to another host later. I can browse them and share them without worrying about my personal data being sold to others or my activity being used to promote related products or services. No one's terms of service, revenue model or changing business leadership is going to affect my ownership and control over my photo collection.
If there's a downside, it's the absence of the network effect that comes with photo sharing communities like Flickr or Instagram. People will be less likely to stumble upon my WordPress-hosted photos than they would if I used one of those services, but I'm okay with that trade-off for now.
Picking/Building a Migration Tool
I'm thankful that Flickr still makes available a very robust API and so I knew that a worst case scenario would be building my own migration tool from scratch. But I didn't want to start there.
My colleague Beau Lebens had already written a plugin, Keyring Social Importers, that uses the Flickr API to continuously fetch Flickr photos into WordPress posts, and I started building a migration process around it. I hit a few snags and submitted some fixes for some of them, and lost momentum. (This doesn't mean it's not a great tool; it is, and I think with the right bits of polish it could actually be the best tool for helping people make this move.)
I knew that even if the import plugin approach above worked, it could take many hours or days to download and process all of my thousands of photos. So after a hiatus of working on this problem, I started to explore ways to get the images on to a WordPress site all at the same time. And that's when I realized that the bulk export tool that Flickr provides would give me everything I needed to do just that.
After initiating a request in my Flickr account, I soon got access to five zip archives of photo files, and one zip archive of JSON files that contain, among other things, meta data for my photos. On my relatively fast home internet connection, downloading all of these took just a few minutes.
I started crafting a PHP script that would, for each photo in the downloaded archives, grab the corresponding meta data and rearrange everything to fit in to WordPress's way of storing content. It generated a resulting WXR export file that is WordPress's native way of exporting and importing content. It also generated a set of directories and sub-directories of photos in just the right "wp-content/uploads" directory structure that a WordPress site uses, ready for copying on to the server where the site would live.
With those two things, I had everything I needed to populate a freshly installed WordPress site with my photos and their titles, captions, comments, metadata (including EXIF) and more. (There were a few hacks to get around the WordPress importer's default assumption that it will be downloading media from a remote site, but hey what's a few more steps in an already 17-step process?)
The final import took a few minutes on my server, and I had a working site! It was pretty exciting. (I did defer the generation of different image sizes in WordPress until after the initial import, which took a few hours to finish in the background. Thanks as always to Alex Mills for Regenerate Thumbnails.)
I published the resulting tool, and a long list of instructions, on GitHub. I hope you find it useful if you're contemplating a similar move. Don't look too closely at the code itself. 🙂
Customization and Cleanup
I spent a fair amount of time customizing my new WordPress photo site to look and work the way I want, including:
- Creating a child theme to support customizations without mangling the original theme.
- CSS customizations for the front page to make the images more prominent.
- Renaming "posts" to "photos" in the WordPress admin, for more clarity in my workflow.
- Creating a custom function that would automatically take the first photo in a new post's content and make the featured image upon publishing, to better support the WordPress mobile app's share extension approach.
- Adding photos to RSS feed post content.
And more.
There's still some other cleanup to do. The main thing is finding/replacing all of my historical blog content that embeds Flickr photos with the corresponding photos from my new WordPress photo site. I think I can automate this with the right tools and will be working on that soon. (Update on Feb 18 2020: I've done this, learn more here.)
Feedback Welcome
I realize this migration tool and process is fairly technical and won't be accessible to everyone. And as I say in the README, since I only tested this process on my own Flickr account I'm 99% sure that it will fall apart in some way for other people. If you open an issue with as many details as possible, I will do my best to offer thoughts on how to further improve this tool to help you.
For now I’m happy to have two decades of photos on WordPress. I’m excited to start posting new photos again after a long pause, now done easily and quickly from the same device I take them on. And I'm thankful that my photos live on a platform that I control.
can it be moved to blogspot too?
Sorry - the tool is engineered for WordPress as a destination.
Hello, thanks a lot for the script!! It worked for me 🙂
During the process I have some little problems:
- First I was not able to know the value of the variable "PROJECT_DIR" in the config file. I finally create a php file "path.php" containing the following line "" to show the path (I use an shared web site on ovh platform and the path is not obvious...)
- The file "generate-wordpress-import.php" do not run correctly until I add chmod 777 on it and add "?>" at the end of the file.
- I have install the "wordpress-importer" directly using the wordpress interface (I have apply the patch using ssh connection). To perform the import I have to go to the wordpress interface > tools > imports > "wordpress" Run importer > Choose the file on my computer. this button open a new page, there I choose my user name and also I check the case "Download and import file attachments"
And here we go! It's done!!!
I have some work to do with the theme but it's a good starting point 🙂
@Maximilien, I'm sorry for the delay in replying. My notes:
> I was not able to know the value of the variable "PROJECT_DIR" in the config file
This is the main directory where the Flickr export files are stored, and where WordPress import files will be generated. No trailing slash.
> generate-wordpress-import.php" do not run correctly
Changing permissions as you did or prefixing it with `php ` on the command line as I did in the example shown in the readme should work.
I'm glad that running the import via web interface worked for you! And glad you found the tool useful overall.
Hi Chris,
I've read with great attention your post. But one question: does your import tool recreate your Flickr's albums and sub-albums ?
And a second one: why don't you create a WP plugin "Import Flickr to WP" ? It would be great for people (like me) uncomfortable with command lines...
Thanks for your reply.
Have a beautiful day !