1.4.1 • Published 10 months ago

react-image-cached-resizer v1.4.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

GitHub npm GitHub release (latest by date)

react-image-cached-resizer

Install

npm install react-image-cached-resizer

yarn add react-image-cached-resizer

We offer a variety of functions

šŸ‘ Improved image rendering speed and performance

āœ… Image Resizing and Optimizing Rendering

āœ… Provides Webp extension conversion

āœ… Image Memory Cache

āœ… server-side rendering

šŸ—ƒ Provide ļø image or avatar widget types

šŸ” Provide image magnification


How to use

import { Image, Avatar } from "react-image-cached-resizer";

function App() {
  return (
    <>
      <Image
        source="https://avatars.githubusercontent.com/u/120083142?v=4" // Image source url
        alt="this image"
        size={{ maxWidth: 400, maxHeight: 300 }} // Image sizes
        ratio={{ x: 3, y: 2 }} // Image size percentage (ratio)
        objectFit="cover"
        zoomUp={true} // Image zoom pop-up or not
        borderRadius={10}
        onClick={() => console.log("onClick")}
      />

      <Avatar
        source="https://avatars.githubusercontent.com/u/120083142?v=4" // Avatar source url
        alt="user-avatar"
        size={100} // Avatar size
        zoomUp={true} // Avatar zoom pop-up or not
        borderRadius={100}
        zoomUpImageSize={400}
        onClick={() => console.log("onClick")}
      />
    </>
  );
}

Image : Use Documentation

PropsTypeFeaturesDescriptionDefault
source (*)string , FileImage source urlEnter the image url or Public image path.
alt (*)string , altalt
zoomUpbooleanImage zoom pop-up or notImage zoom pop-up or notfalse
size.width"auto" , "100%" , stringYou can set a width value within the size.ex_width={{width:’100%’}}100%
size.minWidthnumber , stringYou can set the minWidth value within the size.ex_minWidth={{minWidth:300}}auto
size.maxWidthnumber , stringYou can set the maxWidth value within the size.ex_maxWidth={{maxWidth:300}}auto
size.height"auto" , "100%" , stringYou can set a height value within the size.ex_height={{height:’100%’}}100%
size.minHeightnumber , stringYou can set the minHeight value within the size.ex_minHeight={{minHeight:300}}auto
size.maxHeightnumber , stringYou can set the maxHeight value within the size.ex_maxHeight={{maxHeight:300}}auto
ratio{ x?: number; y?: number }Image size percentage (ratio)Image size percentage (ratio)
objectFit"cover" , "contain" , "fill" , "none" , undefinedSpecify how you want to size your content to fit your elementsSpecify how you want to size your content to fit your elementsundefined
borderRadiusnumber , stringborderRadiusborderRadius0
… props


Avatar : Use Documentation

PropsTypeFeaturesDescriptionDefault
source (*)string , FileImage source urlEnter the image url or Public image path.
alt (*)string , altalt
zoomUpbooleanImage zoom pop-up or notImage zoom pop-up or notfalse
zoomUpImageSizenumberImage zoom pop-up sizeImage zoom pop-up sizefalse
sizenumberAvatar Image SizeAvatar image size must be 1:1 ratio30
objectFit"cover" , "contain" , "fill" , "none" , undefinedSpecify how you want to size your content to fit your elementsSpecify how you want to size your content to fit your elementsundefined
borderRadiusnumber , stringborderRadiusborderRadius0
… props

License

MIT Ā© Deepfactory, Inc. See LICENSE for details.