thumbor-ts-gatsby-image
v1.1.6
Published
Auto convert `thumbor-ts` instances into `gatsby-image` compatible objects
Downloads
3
Readme
Thumbor TS Gatsby Image
Auto convert thumbor-ts
instances into gatsby-image
compatible objects
Usage
import React, { FC } from "react";
import Img from "gatsby-image";
import { useFixed } from "thumbor-ts-gatsby-image";
import { Thumbor } from "thumbor-ts";
// Your encryption key is not required, but your link will be unsafe.
const thumbor = Thumbor({
serverUrl: "http://myserver.thumbor.com",
securityKey: "MY_KEY"
});
const image = thumbor.setImagePath("00223lsvrnzeaf42.png").smartCrop(true);
const Img: FC = () => {
const fixed = useFixed(image, { width: 200, height: 300 });
return <Img fixed={fixed} />;
};