thumbor-sdk
v1.1.2
Published
A minimal dependency library for building thumbor urls.
Downloads
88
Readme
Thumbor SDK
A minimal dependency library for building thumbor urls.
Installation
npm i --save thumbor-sdkyarn add thumbor-sdkUsage
Thumbor
Note: This class requires a security key to be provided, if you need to get the url on the frontend use UnsafeThumbor instead.
url
import { Thumbor } from "thumbor-sdk";
const thumbor = new Thumbor({
endpoint: "http://localhost:8888",
key: "MY-SECURITY-KEY",
});
const url = thumbor.url("/some/my-img.png", {
width: 1920,
height: 1080,
});
console.log(url);
// => http://localhost:8888/Huoc3kthH95DAsvoedAjQB3kleg/1920x1080/some/my-img.pngsign
import { Thumbor } from "thumbor-sdk";
const thumbor = new Thumbor({
endpoint: "http://localhost:8888",
key: "MY-SECURITY-KEY",
});
const hash = thumbor.sign("/some/my-img.png", {
width: 1920,
height: 1080,
});
console.log(hash);
// => Huoc3kthH95DAsvoedAjQB3klegUnsafeThumbor
url
import { UnsafeThumbor } from "thumbor-sdk";
const thumbor = new UnsafeThumbor({
endpoint: "http://localhost:8888",
});
const url = thumbor.url("/some/my-img.png", {
width: 1920,
height: 1080,
});
console.log(url);
// => http://localhost:8888/unsafe/1920x1080/some/my-img.pngSponsors
This library is sponsoed by Uplift!
