GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Vanthink-UED/react-core-image-upload: a component for image to upload and crop

BranchesTags
Open more actions menu

Latest commit

 

History

38 Commits
38 Commits

Folders and files

NameName
Last commit message
Last commit date
__sites_
__sites_
 
 
shots
shots
 
 
src
src
 
 
tests
tests
 
 
.eslintrc.json
.eslintrc.json
 
 
.gitignore
.gitignore
 
 
.npmignore
.npmignore
 
 
.travis.yml
.travis.yml
 
 
LICENSE
LICENSE
 
 
README-ZH.md
README-ZH.md
 
 
README.md
README.md
 
 
karma.conf.js
karma.conf.js
 
 
package.json
package.json
 
 
react-core-image-upload.js
react-core-image-upload.js
 
 
server.js
server.js
 
 
webpack.config.build.js
webpack.config.build.js
 
 
webpack.config.js
webpack.config.js
 
 

Repository files navigation

react-core-image-upload

npm Node Version Build Status

A component for image to upload and crop

Document

中文文档

Install

Use Npm

npm install react-core-image-upload --save

Use yarn

yarn add react-core-image-upload

How to use

import React from 'react';
import ReactCoreImageUpload  from 'react-core-image-upload';
let App = React.createClass({
//...

  render() {
    return(
      <div>
        <ReactCoreImageUpload
          text="Upload Your Image"
          className='pure-button'
          inputOfFile="files"
          url="./api/upload.php"
          imageUploaded={this.handleRes}>
        </ReactCoreImageUpload>
      </div>
    );
  },

  handleRes(res) {
    this.setState({
      // handle response
    })
  }
})

Run demo

cd __sites_ && npm run start

http://localhost:9000/webpack-dev-server/demo/index.html

Demos

Props

Props Data Type Example Details
url String '/crop.php' Your server api
text String 'Upload Image' The text of your uploading button
inputOfFile String       'file' Yout input[file] name
extensions String 'png,jpg,gif' Limit the image type
crop Boolean 'server' Crop image option
cropRatio String '1:1' The cropped image shape(set 'auto' not limit the crop shape)
cropBtn Object {ok:'Save','cancel':'Give Up'} The Text of cropping button text
maxFileSize Number 10485760(10M) Limit the size of the file
maxWidth Number 150 The maximum width of cropped image
maxheight Number 150 限制图片的最大高度
inputAccept string 'image/*' / 'image/jpg,image/jpeg,image/png' the input[file] accept
compress Number 50 Set the quality of compressed image
isXhr Boolean true IF cancel ajax uploading
headers Object {auth: xxxxx} Set customed header when ajax uploading
data Object {auth: xxxxx} Set customed data when ajax posting server

Events

  • imageUploaded: when you finish your image uploading
  • imageChanged: when the input file has changed
  • imageUploading when your image is uploading
  • errorHandle when image uploading meet some error

Demo

Demo Source

Contributions

Your contributions and suggestions are welcome 😄😄😄💐💐💐

About

a component for image to upload and crop

vanthink-ued.github.io/react-core-image-upload/index.html

Resources

Readme
MIT license
Activity
Custom properties

Stars

78 stars

Watchers

7 watching

Forks

21 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.