0.2.4 • Published 4 years ago

@mangoweb/snappyimg v0.2.4

Weekly downloads
268
License
MIT
Repository
github
Last release
4 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 @mangoweb/snappyimg

Usage

import Snappyimg from '@mangoweb/snappyimg'

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

Additional options

import Snappyimg from '@mangoweb/snappyimg'

const snappyimg = new Snappyimg(
	'appToken',
	'appSecret',
	Snappyimg.Stage.Demo // Demo | Serve
)
const options = {
	resize: Snappyimg.Resize.Fill, // Fill | Fit | Crop
	width: 1920, // number
	height: 1080, // number
	gravity: Snappyimg.Gravity.Smart, // Smart | Center | North | South | East | West
	enlarge: true, // boolean
	format: Snappyimg.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.2.4

4 years ago

0.2.3

4 years ago

0.2.1

4 years ago

0.2.2

4 years ago

0.2.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago