josheli

Simple Google Photos: A WordPress Plugin

So I wrote a WordPress plugin to display photos from a public album on Google Photos. You can also get it on Github. You can see the result below, or over there -->, on the right sidebar, near the bottom. That's all it does, it goes and gets the latest photos from an album in Google Photos, then displays them as a grid in a widget or through a shortcode. Most of the time I spent and code I wrote is due to boilerplate and re-learning about plugins. I've written a couple of other plugins, but I don't do it often enough to remember how each time.

[simple_google_photos_grid album-url="https://photos.app.goo.gl/G8EOLs5YtESchh4g1" number-photos="6" number-photos-per-row="3"]

But why doesn't one already exist? WordPress is the most popular CMS, Google Photos is obviously heavily used, seems like there should be dozens of plugins, but there aren't. Mostly it's because Google is a mess. Google is on it's third iteration of a photo platform: Picasa, Google+, and now Photos. They have three versions of a Picasa API, even though Picasa is no more, so none of the APIs work reliably. There is no Photos API. Some Photos content can end up in Google Drive, but not all of it, so the Google Drive API is not useful here. Also, any new album you create in Photos doesn't get added to Picasa (because it doesn't technically exist as a product anymore), and the only way to make an album in Photos "public", is to turn "Sharing on". All that does, though, is provide you with a "sharable link", it doesn't actually promote that album to some public space, it merely removes authentication restrictions on who can view the album.

Really, the Google Photos "API" is a disaster. Or go read through the Google Photos support forums. There's a trail of carnage with people confused and angry.

So I hacked this plugin, without an API, to just scrape the Photos album page. I fully expect it to break in spectacular fashion, or for Google to just silently block access. But for now it works and you can go get it on Github if you want to use it.

And you know, I only wrote this Google Photos plugin because I was copying this plugin for Instagram, which is no longer supported. Even without that plugin dying, I have stopped using Instagram for various reasons like privacy and data collection and attention capitalism (what?). So I'm replacing Instagram with Google (haha, privacy, haha, data collection), and this WordPress plugin is one small brick in the wall of my garden.

[Update] Contrary to what I wrote above, there are a few existing WordPress plugins for displaying Google Photos. I'm not sure why I missed them before, or maybe they just didn't meet my needs so I overlooked them. But I stand by my opinion that photos in the Google-sphere is a mess and that the APIs don't do what you think they do. At any rate, give them a try if you're interested.