DEV Community

Cover image for Image Titler 1.4.1 Features Borders
Jeremy Grifski
Jeremy Grifski

Posted on • Originally published at on

Image Titler 1.4.1 Features Borders

As many of you probably know, I generate all my featured images using a Python script that I wrote for the job. That script is called Image Titler, and I just released version 1.4.1 which features borders.

Inspiration for the Change

As it turns out, my membership site hasn’t exactly blown up over the last couple months, but I have been steadily gaining membership. At this point, I’m closing in on 60 members—most of which are free.

Every once in awhile, one of my members will critique the site. For instance, one of my members recently shared the following feedback:

The “Members” tab shows both “Account” and “Login” no matter if you’re logged in or not (And no “log out”). And if you can’t see a page it just shows “You are unauthorized to view this page.” in small text where the content would be, without telling you if it’s because you’re not logged in, or don’t have a subscription.

Since then, I’ve fixed all of these problems. But, there were more:

There’s also no easy way of seeing if an blog post is free or not. If I go Members.Account > Subscriptions > Basic it sends me to /tag/free which lets me filter the free ones, but I don’t see a way of getting there from the blog itself. Nor are the tags visible in the blog post list.

That last bit of feedback prompted me to think up a way to make it more clear which posts were free and which weren’t. Unfortunately, I don’t really want to play around with PHP and the theme files, so I opted for something I could control: featured images.

Image Borders

Now, when you go to the blog archive, you should see that the featured images are a little different than usual. Instead of the typical two red rectangles and the white title, now you’ll see a colored border around each rectangle.

The colored borders come in two forms: gold and silver. The gold borders indicate premium content while silver borders indicate free content. A featured image without a border just indicates public content.

These borders are accomplished using a pillow 6.0.0 feature which allows you to set an outline on a rectangle with some width. The code I use looks something like the following:

        (IMAGE_WIDTH - width - X_OFFSET * 2, position), 
        (IMAGE_WIDTH, position + RECTANGLE_HEIGHT) 
    outline=TIER_MAP.get(tier.lower(), None), 
Enter fullscreen mode Exit fullscreen mode

If you’d like to try out this new feature, get the latest version of the Image Titler and run the following commands:

image_titler --tier free # Adds a silver border 
image_titler --tier premium # Adds a golder border
Enter fullscreen mode Exit fullscreen mode

Naturally, it’s going to take time to roll out this change for all of my blog posts. At the time of writing, I had 73 of them, so changes could take awhile. For now, I’m going to start with the latest posts and work my way backwards. Hopefully, by the time this is published, all of the posts are updated.


In addition to the border changes, I’ve also added more links to the free and premium content, so hopefully you have an easier time navigating the site. If not, let me know! I’m happy to have the feedback. If everything looks good, then that’s great! I love when my job is easy.

Top comments (0)