npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-thumbor-img

v4.0.3

Published

A React Component that generates images with valid Thumbor URLs for you.

Downloads

221

Readme

react-thumbor-img

You like React? But you use Thumbor?

Worry not, because you have now found the perfect library to use both together in a nice simple component. It currently handles only unsafe URLs, as safe URLs cannot be generated in the client side.

Usage

Usage is simple, very simple:

import React from 'react'
import { ThumborImage } from 'react-thumbor-img'

function MyAwesomeSection(props) {
	return <section>
			<ThumborImage
				server='http://mythumborserver.com'
				src='http://imagestorage/imageurl.jpg'
				height={200}
				width={300}
			/>
		</section>
}

Properties for ThumborImage

server(required): URL of your thumbor server

src(required): URI of the original picture

generateSrcSet: If true, will generate a srcset attribute for the image that will contain 2x and 3x versions of the picture automatically. default: true

width: width in pixel for the standard size of the picture. Use 0 to indicate it should be automatic (original size, or proportional to the height respecting the ratio). default: 0

height: height in pixel for the standard size of the picture. Use 0 to indicate it should be automatic (original size, or proportional to the width respecting the ratio). default: 0

flipHorizontal: set to true if you want to flip the image horizontally default: false

flipVertical: set to true if you want to flip the image vertical default: false

trim: set to true if you want to remove the surrounding space (see here) default: false

fitIn: set to true if you want to shrink the image instead of auto-crop it (see here) default: false

manualCrop: If you want to manually crop the image to a certain position, set this property to an object {top: y1, left: x1, bottom: y2, right: x2}. Set to false for no manual cropping. default: false

horizontalAlign: see here default: 'center'

verticalAlign: see here default: 'middle'

smart: set this to false to disable the smart detection of focal points. See here for more details. default: true

filters: An object which keys correspond to the filter names as defined in the documentation, and values are either:

  • true when no argument is needed for the filter
  • a single value when the filter takes only one argument
  • an array of values corresponding to the parameters to be passed in the right order default: {}

Example:

const filters = {
	grayscake: true,
	background_color: 'blue',
	rgb: [20, 50, 60],
	blur: 7
}

Other Image Properties

id, className, style, alt, crossOrigin: are possible to send and apply to the image