GithubHelp home page GithubHelp logo

react-image-select-tool's Introduction

react-image-select-tool

A react component for selecting images. This component returns a base64 Image.

Deps

##Usage


import ImageFileSelector from "react-image-select-component";

<ImageFileSelector
    ref="imageFileSelector"
    onSelect={this.selectImage} //required
    onRemoveImage={this.onRemoveImage}
    onInvalidImage={this.onInvalidImage}  //required
    maxImageFileSize={this.maxImageFileSize}
    notImage={labels.errors.notImage}
    imageTooLarge={labels.errors.imageTooLarge}
    imageTooSmall={labels.errors.imageTooSmall}
    minSize={this.props.size}/>

###Props onSelect(function) - This receives the file selected(basically an object with the filename, date...) and it returns a base64 image and the file object it self.

For example
 async selectImage(imageBase64, imageFile) {
    //imageBase64 - base64 file
    //imageFile - Object of file selected
 }

onInvalidImage(function) - If an error occures, it recives the error message and sends it back

For example
  onInvalidImage(error) {
		//display error message
	}

notImage, imageTooLarge, && imageTooSmall (string) - These are props containing error messages error messages

 For example
	notImage: 'Please upload an image',
	imageTooLarge: 'This image is too large',
	imageTooSmall: 'This image is smaller than the required file image pixel size'

A usage example can be found here: Usage

react-image-select-tool's People

Contributors

jihdeh avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.