Placeholder image generator

Placeholder image services are useful, which means they get a lot of traffic. Lots of traffic means the service gets hammered, and chances are, when you need it, it will be down.

The solution? Run your own.

You can run this little Express app on your localhost, or on a server, giving you your own private service, akin to placehold.it or DummyImage.

Running the server

Clone this repo:

git clone git@github.com:clocklimited/placeholder.git

Install the npm dependencies:

cd placeholder
yarn install

Install GraphicsMagick. If you are on a Mac (If you are not on a Mac, sorry, I can't help!):

brew install graphicsmagick

Then finally, start the server with:

node app

By default it will listen on port 9999. You can change this by passing in the port as an environment variable:

PORT=1234 node app

Getting images

Construct a URL like so:

http:// [hostname]:[port]/[width]x[height] [format] [?query=params]

Examples

Author

Clock Limited

License

Licensed under the MIT

View the source on GitHub

Live Examples

/650x200

/650x300.jpg?text=Placeholder+Text

/650x220.jpg?text=Pink!&color=ff00ff&textColor=fff

/200