Placehold.it - No Fluff Just Stuff

Placehold.it

Posted by: Mike Girouard on August 5, 2010

Placeholder images shouldn’t be something you think about — they are placeholders after all. Brent and Russell came up with a wonderfully simple API for automatically embedding placeholder images into your web applications.

How does it work? Just put your image size after our URL and you’ll get a placeholder.

A simple 350×150 image can be rendered by adding this to you web app:

<img src="http://placehold.it/350x150">

As you may expect, the height parameter is optional if you simply need a square image:

<img src="http://placehold.it/350">

You can force a specific image type (like GIF, JPEG, or PNG) by specifying an extension at some place in the URI.

<img src="http://placehold.it/350x150.jpg">

Text may be specified by adding the text parameter in the URI. Note: this seems to be a non-standard query string — not sure why they did it that way, but I’m sure they have their reasons.

<img src="http://placehold.it/350x150.jpg&text=Love+Mike+G">

Colors may be specified by adding your foreground and background hex values after the size parameter.

<img src="http://placehold.it/350x150/336699/FF0099.png&text=Love+Mike+G">

This is a great example of a well designed RESTful API. It’s so simple and so useful. I’m surprised that nobody came up with this any sooner!

via Placehold.it.

Share this post

Mike Girouard

About Mike Girouard

Mike Girouard is a web enthusiast based in NYC. He is a active presenter at conferences and user groups, and leads the development of several open source side projects. When he has time, he enjoys getting outside and doing non-nerdy things. Mike can be found on Twitter at @mgirouard and even keeps an infrequently updated blog at lovemikeg.com.

Why Attend the NFJS Tour?

  • » Cutting-Edge Technologies
  • » Agile Practices
  • » Peer Exchange

Current Topics:

  • Languages on the JVM: Scala, Groovy, Clojure
  • Enterprise Java
  • Core Java, Java 8
  • Agility
  • Testing: Geb, Spock, Easyb
  • REST
  • NoSQL: MongoDB, Cassandra
  • Hadoop
  • Spring 4
  • Cloud
  • Automation Tools: Gradle, Git, Jenkins, Sonar
  • HTML5, CSS3, AngularJS, jQuery, Usability
  • Mobile Apps - iPhone and Android
  • More...
Learn More »