0.5.0 • Published 3 years ago

snappyimg v0.5.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

This is a JavaScript implementation of Snappyimg URL builder. For more information about the service, go to https://www.snappyimg.com/.

Installation

This library is available as npm package:

npm install snappyimg

Usage

import { Snappyimg, Stage } from 'snappyimg'

const snappyimg = new Snappyimg('appToken', 'appSecret', Stage.Demo)
console.log(snappyimg.buildUrl('https://placekitten.com/2000/1500'))

Additional options

import { Snappyimg, Stage, Resize, Gravity, Format } from 'snappyimg'

const snappyimg = new Snappyimg(
	'appToken',
	'appSecret',
	Stage.Demo // Demo | Serve
)
const options = {
	resize: Resize.Fill, // Fill | Fit | Crop
	width: 1920, // number
	height: 1080, // number
	gravity: Gravity.Smart, // Smart | Center | North | South | East | West
	enlarge: true, // boolean
	format: Format.Jpg, // Jpg | Png | Webp
}
console.log(snappyimg.buildUrl('https://placekitten.com/2000/1500', options))

Warning

Don't use this library on frontend if you care to keep your appSecret private.

0.3.0

3 years ago

0.5.0

3 years ago

0.4.0

3 years ago

0.3.1

3 years ago

0.2.5

3 years ago