imagizer-node

1.2.1 • Public • Published

imagizer-node

imagizer-node is an npm package that provides the common boilerplate for Imagizer server-side JavaScript-based functionality.

Installing

imagizer-node can be installed as either via npm:

$ npm install --save imagizer-node

Usage

const ImagizerClient = require('imagizer-node');

const client = new ImagizerClient({
  // Specify your Imagizer source endpoint
  imagizerHost: 'examples.cloud.imagizer.com',

  // Optionally, use https for secured websites
  useHttps: true,
});

let returnRelativeURL = false;

const url = client.buildURL('/path/to/image.png', {
  w: 400,
  h: 300
}, returnRelativeURL); // returnRelativeURL argument is `false` by default

console.log(url); // => "https://my-social-network.imagizer.com/users/1.png?w=400&h=300&s=…"

returnRelativeURL = true;

const relativeURL = client.buildURL('/path/to/image.png', {
  w: 400,
  h: 300
}, returnRelativeURL);

console.log(relativeURL); // => "/users/1.png?w=400&h=300&s=…"

// ^^^ Useful for layers and watermarks. Also makes base64 encoded layers shorter

Testing

imagizer-node uses mocha for testing. Here’s how to run those tests:

npm test

Readme

Keywords

none

Package Sidebar

Install

npm i imagizer-node

Weekly Downloads

5

Version

1.2.1

License

BSD-2-Clause

Unpacked Size

17.5 kB

Total Files

8

Last publish

Collaborators

  • oaleynik