DEV Community

Cover image for PlaceKeanu.com — A slightly more breathtaking placeholder service
Alexander Sandberg
Alexander Sandberg

Posted on • Edited on

PlaceKeanu.com — A slightly more breathtaking placeholder service

You know those times when you work on a web dev project, and need an image in 300x250px real quick?

Or maybe you need a placeholder for your avatar photos, while the project is still in development.

While there are a bunch of amazing alternatives already (picsum.photos, placeholder.com, and placekitten.com, to name a few) I had a feeling something was missing... 🤔

This weekend I put together something to make everyone's web dev process a bit more breathtaking. Some might've seen it featured on ProductHunt yesterday, but since everyone seemed to love it so much there, I wanted to share it with you guys as well. ❤️


PlaceKeanu.com is a placeholder image service based on—you guessed it—Keanu Reeves!

Keanu Reeves wink

I mean just look at him. How could this not be a thing already?

So, how do you use this lifechanging (ymmv) service?

Simply paste a link in this format, wherever you need to Keanu it up:

https://placekeanu.com/[width]/[height]*/[options]*
(* optional)

If you don't pass in a height, the size will be a square based on the width.

Available [options]

  • Young Keanus only: y
  • Grayscale Keanus: g

Here are some examples

So if you want to use a Keanu on your website, you could for instance include him with an <img>, like this:

<img src="https://placekeanu.com/350/500" alt="">

Not bad, huh?

Keanu Reeves thumbs up

Woot! How did you build this fine piece of art?

While most placeholder image services dynamically create images for every request, I found a way to achieve the same result using SVGs.

Basically, when you visit a page, say /200/300, an SVG with width="200" and height="300" is returned, together with a random image of Keanu. All images are coded in Base64 to get it working properly.

There are some other magic involved as well, like automatic centering and choice of a vertical or horizontal Keanu, based on your request, so that he won't get cut off as often.

The source code for the project is of course available on GitHub, so please check it out here! 🙂


I would love to hear your thoughts about this, and any feature requests you might have. Post a comment below, or send me a tweet on Twitter (@alexandberg)!

And let me know if you would like a more in-depth explanation of how I built this—using Express together with Netlify Functions—and I'll write something up!

But for now, please enjoy the lovely and wholesome Keanu! ❤️

Keanu Reeves blow kiss


Oh, and btw, I just created a listing with a very interesting (and for me, lifechanging) opportunity. It would mean the world to me if you shared my tweet about it. ☺️

Top comments (6)

Collapse
 
autoferrit profile image
Shawn McElroy

My biggest request would be to pass say "f" to have a gif returned. But I'm sure you wouldn't be able to encode those the same. Would the sizes also work? What if we just do

placekeanu.com/gif

To get a random gif?

Collapse
 
alexandersandberg profile image
Alexander Sandberg

Love the suggestion, Shawn!

It's actually possible to encode GIFs to Base64, but the size of the data strings can get quite large (we're talking a few MB, so not that bad).

But yes, that would actually allow for GIFs in any sizes, just like the way the photos are working now. And additional GIF filters, like Grayscale? Yuuup! 😃

Collapse
 
msfjarvis profile image
Harsh Shandilya

You're breathtaking!😆

Collapse
 
jess profile image
Jess Lee

hahah this is amazing

Collapse
 
fischgeek profile image
fischgeek

Haha! I love this!

Collapse
 
alexandersandberg profile image
Alexander Sandberg

I hope it'll come in handy! 😍