thumbor-browser

1.0.1 • Public • Published

ThumboJS - a NodeJS Thumbor Url Builder

ES2015-style Thumbor URL generator for Node JS.

browsers are not supported simply because to use the code in the browser would imply either having to supply the encryption-key to the browser or not use an encryption key, neither of which is a good idea.

a refactor of the following projects (with thanks to them!) ...

Install (requires npm)

npm install thumbor

Testing

You can run a basic set of tests (and linting) with:

npm test

You can run tests to validate the hash generation with:

npm run test-hashing

N.B. these require Python & Thumbor be installed locally

You can run tests against a running instance of Thumbor with:

npm run test-requests

N.B. by default the requests will be performed against "http://localhost:8888", you can change this by setting the env-var THUMBOR_URL

Usage

const ThumborJS = require('thumborjs');

// Your encryption key may be NULL, but if so your links will be unsafe (this is definitely NOT RECOMMENDED).
const myKey     = 'MY_KEY'; 

// init url generator
const tugen     = new ThumborJS('http://localhost:8888', myKey);

// generate a url
const url       = tugen.setImagePath('foobar.png').resize(50,50).buildUrl();

Readme

Keywords

Package Sidebar

Install

npm i thumbor-browser

Weekly Downloads

7

Version

1.0.1

License

MIT

Unpacked Size

19.5 kB

Total Files

12

Last publish

Collaborators

  • styria