Gathering detailed insights and metrics for @gfnork/react-images-uploading
Gathering detailed insights and metrics for @gfnork/react-images-uploading
Gathering detailed insights and metrics for @gfnork/react-images-uploading
Gathering detailed insights and metrics for @gfnork/react-images-uploading
The simple images uploader applied Render Props pattern that allows you to fully control UI component and behaviors.
npm install @gfnork/react-images-uploading
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (76.85%)
JavaScript (19.13%)
Shell (2.25%)
HTML (0.93%)
Dockerfile (0.83%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
321 Stars
141 Commits
53 Forks
2 Watchers
22 Branches
5 Contributors
Updated on Apr 21, 2025
Latest Version
3.1.7
Package Id
@gfnork/react-images-uploading@3.1.7
Unpacked Size
42.63 kB
Size
10.52 kB
File Count
13
NPM Version
8.12.2
Node Version
16.15.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
48
The simple images uploader applied Render Props
pattern. (You can read more about this pattern here).
This approach allows you to fully control UI component and behaviours.
npm
1npm install --save react-images-uploading
yarn
1yarn add react-images-uploading
You can check out the basic demo here:
Basic
1import React from 'react'; 2import ImageUploading from 'react-images-uploading'; 3 4export function App() { 5 const [images, setImages] = React.useState([]); 6 const maxNumber = 69; 7 8 const onChange = (imageList, addUpdateIndex) => { 9 // data for submit 10 console.log(imageList, addUpdateIndex); 11 setImages(imageList); 12 }; 13 14 return ( 15 <div className="App"> 16 <ImageUploading 17 multiple 18 value={images} 19 onChange={onChange} 20 maxNumber={maxNumber} 21 dataURLKey="data_url" 22 > 23 {({ 24 imageList, 25 onImageUpload, 26 onImageRemoveAll, 27 onImageUpdate, 28 onImageRemove, 29 isDragging, 30 dragProps, 31 }) => ( 32 // write your building UI 33 <div className="upload__image-wrapper"> 34 <button 35 style={isDragging ? { color: 'red' } : undefined} 36 onClick={onImageUpload} 37 {...dragProps} 38 > 39 Click or Drop here 40 </button> 41 42 <button onClick={onImageRemoveAll}>Remove all images</button> 43 {imageList.map((image, index) => ( 44 <div key={index} className="image-item"> 45 <img src={image['data_url']} alt="" width="100" /> 46 <div className="image-item__btn-wrapper"> 47 <button onClick={() => onImageUpdate(index)}>Update</button> 48 <button onClick={() => onImageRemove(index)}>Remove</button> 49 </div> 50 </div> 51 ))} 52 </div> 53 )} 54 </ImageUploading> 55 </div> 56 ); 57}
Validation
1... 2 {({ imageList, onImageUpload, onImageRemoveAll, errors }) => ( 3 errors && <div> 4 {errors.maxNumber && <span>Number of selected images exceed maxNumber</span>} 5 {errors.acceptType && <span>Your selected file type is not allow</span>} 6 {errors.maxFileSize && <span>Selected file size exceed maxFileSize</span>} 7 {errors.resolution && <span>Selected file is not match your desired resolution</span>} 8 </div> 9 )} 10...
Drag and Drop
1... 2 {({ imageList, dragProps, isDragging }) => ( 3 <div {...dragProps}> 4 {isDragging ? "Drop here please" : "Upload space"} 5 {imageList.map((image, index) => ( 6 <img key={index} src={image.data_url} /> 7 ))} 8 </div> 9 )} 10...
parameter | type | options | default | description |
---|---|---|---|---|
value | array | [] | List of images | |
onChange | function | (imageList, addUpdateIndex) => void | Called when add, update or delete action is called | |
dataURLKey | string | dataURL | Customized field name that base64 of selected image is assigned to | |
multiple | boolean | false | Set true for multiple chooses | |
maxNumber | number | 1000 | Number of images user can select if mode = multiple | |
onError | function | (errors, files) => void | Called when it has errors | |
acceptType | array | ['jpg', 'gif', 'png'] | [] | The file extension(s) to upload |
maxFileSize | number | Max image size (Byte) and it is used in validation | ||
resolutionType | string | 'absolute' | 'less' | 'more' | 'ratio' | Using for image validation with provided width & height | |
resolutionWidth | number | > 0 | ||
resolutionHeight | number | > 0 | ||
inputProps | React.HTMLProps<HTMLInputElement> |
resolutionType
value | description |
---|---|
absolute | image's width === resolutionWidth && image's height === resolutionHeight |
ratio | (resolutionWidth / resolutionHeight) === (image width / image height) |
less | image's width < resolutionWidth && image's height < resolutionHeight |
more | image's width > resolutionWidth && image's height > resolutionHeight |
parameter | type | description |
---|---|---|
imageList | array | List of images to render. |
onImageUpload | function | Called when an element is clicks and triggers to open a file dialog |
onImageRemoveAll | function | Called when removing all images |
onImageUpdate | (updateIndex: number) => void | Called when updating an image at updateIndex . |
onImageRemove | (deleteIndex: number | number[]) => void | Called when removing one or list image. |
errors | object | Exported object of validation |
dragProps | object | Native element props for drag and drop feature |
isDragging | boolean | "true" if an image is being dragged |
Thanks goes to these wonderful people (emoji key):
vutoan266 💻 🤔 📖 🚧 ⚠️ 👀 | David Nguyen 💻 🤔 📖 👀 | DK 💻 🚇 🤔 👀 📖 | Isaac Maseruka 💻 |
This project follows the all-contributors specification. Contributions of any kind welcome!
No vulnerabilities found.
Reason
no vulnerabilities detected
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
no binaries found in the repo
Reason
update tool detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 7
Details
Reason
2 commit(s) out of 30 and 5 issue activity out of 30 found in the last 90 days -- score normalized to 5
Reason
GitHub code reviews found for 8 commits out of the last 30 -- score normalized to 2
Details
Reason
no badge detected
Reason
non read-only tokens detected in GitHub workflows
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Reason
project is not fuzzed
Score
Last Scanned on 2022-08-15
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More