1.0.3 • Published 5 months ago

react-image-optimizer v1.0.3

Weekly downloads
-
License
-
Repository
github
Last release
5 months ago

A lightweight package that automatically optimizes images based on the user's device and viewport.

Usage

npm i react-image-optimizer
import OptimizedImage from "react-image-optimizer";

return (
    <OptimizedImage
        alt="Example Image"
        width={1200}
        height={800}
        srcSet="https://images.dog.ceo/breeds/hound-afghan/n02088094_1003.jpg 320w,
                https://images.dog.ceo/breeds/hound-afghan/n02088094_10263.jpg 480w,
                https://images.dog.ceo/breeds/hound-afghan/n02088094_10715.jpg 800w,
                https://images.dog.ceo/breeds/hound-afghan/n02088094_10822.jpg 1200w"
        sizes="(max-width: 600px) 320px, (max-width: 1024px) 480px, 800px"
        fallbackSrc="https://images.dog.ceo/breeds/hound-afghan/n02088094_1145.jpg"
    />
);

Props

NameUsage
srcImage Url
altAlternate text
widthNumber
heightNumber
srcSetString of Images to be displayed for different view ports
sizesSize configurations
fallbackSrcFallback Image Url

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago