Automatically Generated WordPress Featured Images?

As I was writing my last post, there was a moment where I had to think about about what featured image I wanted to use. I didn’t really have one, so I just picked my profile picture. It worked, I guess, but I don’t think this is a sustainable approach. Ideally, I’d like to have a unique image for every post.

But this sounds like a lot of work, and I’m lazy. Perhaps WordPress can offer an assist?

I’m thinking of adding a feature to my theme to automatically generate a post image, save it to the Media library, and then append it to the post. I think all of the elements I need are already available:

  1. PHP can create image files, and upload them the WordPress upload location.
  2. The theme should be able to create an “attachment” post type with the image details.
  3. Then, upon successful upload, append the attachment ID to the post I’m authoring.

As far as the substance of the images themselves, I’m thinking it should be easy enough to retrieve a profile picture of the author, or the header image/colour from the theme, and put that into the image. The excerpt of the post can be used as a text overlay. Give it a nice trendy layout and, voila!

I’ll get to prototyping something when I can. Should be fun!