API, Programming, WordPress

Share an iPhoto Library on the Web with WordPress

I recently needed to publish the contents of an iPhoto library online, so I wrote a script that converts the library to a WordPress site using WordPress’s REST API.  The script is available in my iPhoto-WordPress-Export repository on GitHub. Check it out, and then run it like this:

$ ./iphoto2wordpress.php --library=/path/to/photo/library --wordpress=https://www.example.com/

After prompting for a username and password, it will upload all of the library’s photos to the specified WordPress site. For each event in the library, it creates a post that includes a gallery containing all of the images from the event.  It will also convert any albums into categories, categorizing the photos themselves, not the posts. (For this to work, you will need to enable categories for attachments.)

If the script stops for any reason, you can restart it, and it will pick up where it left off. Depending on what it was doing when it stopped, you may have an orphaned attachment in your Media.

Posts are created as drafts and left for you to publish at your leisure.

I used this script to create DavidTewes.com.  (For back-story on what that site is and how it came to be, see this post.) Because the site is image-centric, I chose a photography based theme called Silvia, and I made a few adjustments to it:

I could have had the script automatically assign a featured image to each post, but I chose to make that decision manually. Here’s the end-result:

Let me know if you have any questions, and if you use the script, leave a link to the site you used it on in the comments below!

Standard
Alexa, Amazon, Programming, WordPress

Alexa, start a new post called, “I’m blogging this with my voice.”

I’ve written and published an Alexa skill that lets you check your blog notifications, moderate comments, and start new draft posts on your WordPress.com or Jetpack-enabled blog, all by speaking to any Alexa-enabled device.

Wapuu hugging an Amazon Echo Dot The skill is called “Blog Helper“; you’ll find it in the Skills section of your Alexa app or by saying, “Alexa, enable the Blog Helper skill.” After linking your WordPress.com account and choosing the blog you want to access, you can begin using the skill.

To check your notifications, just ask: Alexa, open Blog Helper and check my notifications.” Alexa will read the new ones to you one-by-one, marking each one as read as you listen to it.

You can create draft blog posts with Alexa too. Say, “Alexa, tell Blog Helper to create a new post called ‘My thoughts on gardening.'”  This skill will save the post as a draft so you can expound on your ideas later.

Comment moderation has never been easier (or more vocal). “Alexa, ask Blog Helper if I have any new comments,” and you’ll be able to approve, delete, or mark them as spam.

Blog Helper uses the WordPress.com REST API, and it’s completely open-source.

Standard
Unpredictable Image Filenames, WordPress

New WordPress Plugin: Unpredictable Image Filenames

I’ve written a new WordPress plugin to help protect uploaded images from being accessed just by guessing the URL.

Many cameras and smartphones number their images in a predictable format. For example, iPhones use the format IMG_0001.jpg. If you include IMG_0345.jpg in a blog post, an unsavory third party could start regularly trying to access IMG_0346.jpg, attempting to view the image before you publish a post containing it.

Or, maybe you have a private blog that you only allow family members to read. Not all “private blog” plugins are able to require authentication to load images from /wp-content/, so the same unsavory third party could just start guessing URLs like /wp-content/uploads/2016/05/IMG_0001.jpg, hoping to eventually get a hit. 9,999 requests would enumerate every possible image from an iPhone for each month, almost definitely allowing an unauthorized person access to your photos.

The Unpredictable Image Filenames plugin for WordPress renames image files to a sufficiently unguessable name when you upload them. For example, IMG_0345.jpg could end up as 334AB1E8-28AB-4BE1-882D-3C112E95F055.jpg, and IMG_0346.jpg could be renamed A67C9CF9-0BB5-4FB4-AD03-DCB294F853EC.jpg. Try and guess that!

You can install Unpredictable Image Filenames from your WordPress admin plugins screen, download it from the .org plugins directory, or view the source on GitHub.

Standard
Facebook, Themes, Twitter, WordPress

Keyring River: A new WordPress theme to complement Keyring Social Importers

It’s no secret that I use Keyring and Keyring Social Importers to import my activity on third-party services into a WordPress blog. All of my Facebook posts and photos, Twitter updates, foursquare checkins, and Reddit comments and submissions are archived in a single location; this makes it simple to see a snapshot of my online life at any point in time. I’ve even imported my IM chat transcripts from over a decade ago.

I’ve long been searching for the perfect WordPress theme to showcase all of this data. Typical blog themes didn’t work because each “post” needed different styling based on the service it came from, so it was unlikely that I was going to find what I needed already built for me.

But then, I came across an effort by David Hariri to build a non-WordPress lifestreaming product called River. While I’m already committed to using WordPress, his frontend design was exactly what I had been looking for. Luckily, David’s project is open source and MIT-licensed, so I was able to use his design and adapt it to a WordPress theme. With that, I present Keyring River:

screenshot-1

Keyring River is a new WordPress theme coded specifically to complement Keyring Social Importers. It’s feature-poor and purposefully so; there are no sidebars, no footers, no menus, no comments — just a search box and a list of activity. For maximum enjoyment, install Jetpack and activate the Infinite Scroll module so that you can scroll infinitely into your online history. See it in action on my example lifestream blog, where I’ve imported my Twitter and Reddit history.

The timestamp on each entry links to the single-item view in WordPress, and the logo links to the item on the service it was originally posted on. Amuse yourself by scrolling back a couple of years, finding an interesting Facebook post, and reviving discussion on it!

Keyring River currently supports posts imported by the following plugins:

…and of course, regular WordPress posts.

Download Keyring River from Github, and let me know if you put it into practice. Taking ownership of your data is important, and more importantly, it’s fun!

Standard
Plugins, Programming, Reddit, WordPress

Import your Reddit activity into WordPress

I try to maintain a copy of all of my social media activity in a single WordPress-powered archive. Twitter, Facebook, foursquare, Reddit, Usenet, chat logs: all searchable in one place via a single search box. Or, I can just scroll back in time, using Jetpack’s Infinite Scroll module. It’s heavenly.

Screen Shot 2014-01-17 at 12.09.02 AM

To import my activity from third-party services, I use Keyring Social Importers. Keyring Social Importers ships with support for a handful of services, but not Reddit, so I’ve written a WordPress plugin that adds support for importing comments and submissions from Reddit.

The plugin (“Reddit for Keyring”) is available at Github. (Make sure you install Keyring and Keyring Social Importers first.) After installing it, use it like any of the other Keyring Social Importers. Submissions (both link and text) and comments will be imported and saved as posts.

Let me know if you use it; bug reports are welcome in the comments below or in the Github project.

Standard
AOL, Plugins, Programming, WordPress

Import your chat transcripts into WordPress

Problem: You have years’ worth of chat (AIM/MSN/Adium/IRC) transcripts saved on your computer, and you’d love to stroll down memory lane and reread some of them, but how? Manually open each one in your browser or chat program?? There’s got to be a better way!

Solution: Install IM-porter, the WordPress plugin that imports your instant message transcripts to your WordPress blog so you can read through conversations from ages past just as easily as you browse the archives of a blog.

After activating the plugin, visit Tools > Import > Chat Transcripts. Then, you can upload a single transcript or a ZIP of transcripts.

IM-porter currently supports transcripts from:

  • AOL Instant Messenger
  • MSN Messenger
  • Adium
  • Colloquy

but you can extend it to parse other formats too. (See the README.)

Imported posts are given the chat post format, and you have the option of tagging them with the participants’ usernames, making them public or private, and adding them to a category.

The IM-porter configuration screen.

After they’re imported, chats will look something like this:

A chat imported by IM-porter

The output may not be perfect (the output will not be perfect), but the original raw transcript is saved as post meta so the post can be updated if you want or fixed by a later version of IM-porter.

If you want to style your chats like AIM used to display them (like in the screenshot I included), you can use this CSS:

.post.format-chat .entry-content p {
	margin-bottom: 0 !important;
}

.post.format-chat .entry-content span {
	color: #00f;
	font-weight: bold;
}

.post.format-chat .entry-content span.participant-1 {
	color: #f00;
}

.post.format-chat .entry-content span time {
	font-size: x-small;
}

Standard
Facebook, Programming, WordPress

Export your Facebook posts to WordPress

I’m a big proponent of owning the data that you create. I use WordPress (of course) wherever I blog, and I use the Keyring Social Importers plugin to make backup copies of my Twitter updates and Foursquare checkins. And as of today, I am also syncing my Facebook updates back to a private WordPress blog using Keyring Social Importers.

Not familiar with Keyring Social Importers? That’s too bad, it’s amazing. Install it, and within minutes, you can be importing data from any one of a dozen sites to your blog. Remember all of that data you put into Myspace/Jaiku/Bebo/Pownce and how it disappeared when the site shut down? Wouldn’t it have been nice to be able to save a copy of all of that? That’s what Keyring Social Importers makes possible.

There’s no built-in Facebook importer in Keyring Social Importers, so I wrote one. You can use it to save copies of your Facebook photos, photo albums, and status updates to an easy-to-browse (and easy to share) WordPress blog.

To use the Facebook importer, install Keyring Social Importers, copy the keyring-importer-facebook.php file into wp-content/plugins/keyring-social-importers/importers/, and then visit Import > Facebook to get started. Let me know what you think.

Note: I’ve only tested the importer on my own account, so it’s possible that it won’t be perfect. All imported data is set to private, just to be safe. Patches and bug reports are welcome.

Standard