Skip to content

borgespro/vanilla-thumbor-url-builder

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Thumbor URL builder

Fork of: Thumbor client for JavaScript.

Installation

npm i vanilla-thumbor-url-builder

Declare in JS

import Thumbor from "vanilla-thumbor-url-builder";
const thumbor = new Thumbor("my_key", "https://my-site.com/thumbs");

Generate your URL

const thumborize = thumbor
  .filter("format(webp)")
  .setImagePath("https://my-site.com/image.jpeg")
  .resize(600, 400)
  .buildUrl();
// .env

thumborKey = "gr4mf3t3gsg4g3g3d3d";
thumborUrl = "https://my-site.com/thumbs";

// thumborize.js

import Thumbor from "thumbor-js-url-builder";
const thumbor = new Thumbor(process.env.thumborKey, process.env.thumborUrl);

const thumborize = (type = "jpeg", url, num = 1, width = 600, height = 400) => {
  return thumbor
    .filter(`format(${type})`)
    .setImagePath(url)
    .resize(width * num, height * num)
    .buildUrl();
};

export default thumborize;

About

Thumbor client for RN

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%