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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-cloudinary-lazy-image

v1.3.4

Published

Lazy-loading React image component based on Cloudinary api

Downloads

106

Readme

react-cloudinary-lazy-image

Optimised images with Cloudinary.

'react-cloudinary-lazy-image' is React component which cover "blur-up" effect, lazy-loading and formatting. The component is based on Gatsby image by Kyle Mathew, however instead of GraphQL and Gatsby it uses Cloudinary API. Have a speed and optimized gatsby-images without gatsby.

Covers

  1. Downsize larger images to the size needed by your design - even on desktop there is no need to get as big image as possible.
  2. Remove metadata from delivered images - by default images contain a lot of information useful for cameras and graphics applications, but not for web users.
  3. Format images to newer formats like JPEG-XR and WebP - common formats like PNG, JPG or GIF are not optimised to be send wireless.
  4. Lower image quality - many images have extra-high resolution, however it’s possible to lower quality without a significant visual impact.
  5. Downsize images on smaller device - display images for mobile users faster as there is probably slower internet connection.
  6. Lazy load images - allow images to download only when user scroll to it allows to speed up initial page load.
  7. Hold position of element - page doesn’t jump while images load.
  8. “Blur-up” technique - show very low resolution image before the original loads.

Points 1-4 are handled by Cloudinary.

Install

npm install react-cloudinary-lazy-image --save

How to use

Fixed example:

import React from 'react'
import Img from 'react-cloudinary-lazy-image'

export default ({publicId}) => (
    <div>
        <h1>Lazy-image with Cloudinary</h1>
        <Img
            cloudName={'cloud'}
            imageName={publicId}
            fixed={{
                width: 300,
                height: 300
            }}
            urlParams={'g_face,c_lfill'}
        />
    </div>
)

Fluid example:

import React from 'react'
import Img from 'react-cloudinary-lazy-image'

export default ({publicId}) => (
    <div>
        <h1>Lazy-image with Cloudinary</h1>
        <Img
            cloudName={'cloud'}
            imageName={publicId}
            fluid={{
                maxWidth: 300,
                height: 300
            }}
            style={{
                width: '40vw',
                height: '20vh'
            }}
        />
    </div>
)

Two types

Same as in gatsby-image there are two types of responsive images. Fixed and fluid.

  1. Images with fixed height and width. Cover double pixel density for retina display.
  2. Images in fluid container. Takes smallest possible picture to fill container. Configurable step allow you to have control over breakpoints.

Image transformation

You can set image transformation according to Cloudinary documentation, by setting urlParams. You can also find all formats that can be passed to imgFormat prop or get more info about quality prop.

Props

| Name | Type | Description | | ------------------ | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | | fixed | object | Object with 'width' and 'height' properties | | fluid | object | Object with 'maxWidth' required property. Optionally step, default=150 and 'height'. If height not set, uses 'c_scale' otherwise 'c_lfill' | | fadeIn | bool | Defaults to fading in the image on load | | cloudName | string | Cloudinary cloud name, default=process.env.CLOUD_NAME or process.env.REACT_APP_CLOUD_NAME | | imageName | string | Cloudinary publicId | | urlParams | string | Cloudinary image transformations params. Overrides default 'c_lfill' or 'c_scale'. If both weight and height (w_, h_) params are set srcSet will not be created.| | title | string | Passed to the img element | | alt | string | Passed to the img element | | style | object | Spread into the default styles of the wrapper element | | imgStyle | object | Spread into the default styles of the actual img element | | placeholderStyle | object | Spread into the default styles of the placeholder img element | | backgroundColor | string / bool | Set a colored background placeholder instead of "blur-up". If true, uses default "lightgray" color. You can also pass in any valid color string. | | onLoad | func | A callback that is called when the full-size image has loaded. | | onError | func | A callback that is called when the image fails to load. | | imgFormat | string / bool | Allow Cloudinary to format image. By default is set to 'f_auto'. Can be switch off by passing 'false' or be formatted to specific format (ex. 'webp') | | quality | string / bool | Allow Cloudinary to change quality of image. By default is set to 'q_auto'. Can be switch off by passing 'false' or to specific value (ex. 'best') | | version | string | Set Cloudinary optional version param. Doc. | | blurSize | number | Width of the low quality image. Default = 20. | | blurUrlParams | string | Cloudinary image transformations params for blur version. | | useUrlParamsToBlur| bool | Flag to use urlParams for blur version. Overrides blurUrlParams. | | IOParams | object | Passed to window.intersectionObserver options. Default: { rootMargin: '200px' } |