A HTTP service to generate PNG previews of SVG images. Bundles external dependencies using svgbundler, converts to PNG, then uploads the result to S3.
Accepts POST / requests with SVG contents, and returns a URL string.
$ npm install
$ make dev
$ curl -X POST -d "@file.svg" http://localhost:5101Several environment variables must be defined to run an instance of svgthumb:
AWS_ACCESS_KEY- Your AWS access keyAWS_SECRET_KEY- Your AWS secret keyAWS_S3_BUCKET_NAME- The S3 bucket to upload files into
Other optional configuration:
CLIENT_TOKEN- A shared token that clients must provide in a request header of the formatAuthorization: Token CLIENT_TOKEN_GOES_HERE.PORT- HTTP server port (default: 5101)
For local development, you can specify these in a .env file in the project
directory:
$ cat .env
AWS_ACCESS_KEY=123123
AWS_SECRET_KEY='abc12312'
AWS_S3_BUCKET_NAME='svgthumb-uploads-dev'
- Use headless Chrome rather than PhantomJS. Explored using ImageMagick, but the results were much worse (many advanced SVG features unsupported).
- Build a more robust auth system.