Skip to content

kleitz/quotable

 
 

Repository files navigation

Quotable

A webservice, written in Go, to generate Twitter-size images of quotes from articles as images.

Written in a weekend as a proof of concept, and as an excuse to use Go.

How does it work?

First: add a file named base.png in the assets folder.

The frontend JavaScript posts the contents of the current highlighted selection to the /create endpoint.

This generates a unique string as a key, which is the URL segment.

/{key}.png serves a PNG

/{key}.json gives the database row result as JSON

PNG takes the text from the database and creates a transparent image. This is then overlayed with the base.png

It requires two environment variables: DATABASE_URL and FONT_FILE.

TODO

There is a chance of key string collisions. There is a uniqueness validation in setup.sql.

We probably shouldn't panic on bad JSON, so handle this in a nicer way.

Generating PNGs on the fly isn't that efficient.

Contributing

Pull requests welcome

About

Golang webapp to quote portions of article text into a Twitter-shareable image using Go's Image package

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 50.6%
  • Go 27.9%
  • HTML 21.5%