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-next-gen-image

v1.0.3

Published

React Next Gen Image Component

Downloads

4

Readme

React Next Gen Image Component

What is required

  • Something just like this repo: Next Gen Image Creation

    • This repo contains several scripts. If you do these three steps (perhaps more if you do not have an AWS account) then you will be setup to use this component. Each step is a script in the repository.

      1. Create an S3 bucket (basically a place to store images on AWS).
      2. Convert these images into a corresponding .webp (for most browsers... Chrome, Firefox, Opera, Android) and .jp2 for Safari (Web and Mobile).
      3. Call a shell script that pushes each every file to S3. The script puts .webp images into a webpImages folder and corresponding folders for other image types. This is necessary for the component.

If you do this you are set.

How to install

npm install react-next-gen-image

How to use it

import NextGenImage from 'react-next-gen-image';

<NextGenImage
  bucket="yours3bucketname"
  imageName="name-of-image"
  placeholder="name-of-image.jpg"
  imageProperties={{
    alt: 'this signifies the name of image',
    className: 'this-image-is-nice',
    ...whateverImageElementPropertiesYouWant
  }}
/>

Properties

  • bucket - string
    • This is required.
    • It's an S3 bucket name.
      • Yes, you have to use S3. It's cheap, unless you're a very big company. In which case, it's probably cheaper than what you were using before.
  • imageUrl - string
    • This is required.
    • It's kind of the path to the image in the S3 bucket. AWS calls it a Key.
      • Why kind of? Because you only put the image name, not the extension (jpg, png, etc.). This is done to make it so you don't have to go someFolderName/image-name.someExtension for all image types.
  • placeholder - string
    • This is not required.
    • This is what is shown while the image is loading. If it's a big image, a small placeholder will create a smoother transition.
  • imageProperties - object
    • This is not required.
    • Put whatever properties you want in here. They're spread into the image element: <img src={s3url} {...imageProperties} />.

Super tiny, npm install it or (better) copy the code and use it /src/index.js && /src/utils.js is all you need.

File sizes after gzip:

  umd/react-next-gen-image.js      3.14 KB
  umd/react-next-gen-image.min.js  1.18 KB
...