Skip to content

murny/portrait

 
 

Repository files navigation

Portrait is a web service which converts a website into a image. The actual hard work is handled by Google’s Puppeteer. Portrait is primarily designed to be used as a service, but does have a minimal admin interface.

You’ll need to be able to run Puppeteer via Node.js. You’ll also need to be able to run a Rails stack. Portrait is built on Ruby 2.3.3 and Rails 5.2

The provided setup script should take care of all the necessities: installing dependencies, setting up a database, and creating a temporary admin user.

$ ./bin/setup

Once that completes successfully, spin up a rails server

$ rails server

And visit localhost:3000

Send a POST request like below. Use basic http authorization and provide a parameter named site[url]. You can test it with curl:

curl -X POST -d "site[url]=https://google.com" -H "Accept: application/json" http://admin:admin@localhost:3000/sites

On a valid url, you’ll get a json response like this:

{
  "site": {
    "id": 1,
    "status": "succeeded",
    "image": {
      "url": ".../1.png"
    }
  }
}

About

Web service that turns a web page into an image

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Ruby 80.7%
  • JavaScript 9.6%
  • HTML 6.9%
  • CSS 2.8%