1.0.6 • Published 6 years ago

js-upload-image v1.0.6

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

#js-upload-image

Chinese documents

1.Introduction

This is a github repository with an object for mobile upload images.

2.Usage

1.Installation

  • Method 1: Use the npm command to install, npm install --save js-upload-image.
  • Method 2: Copy the contents of the upload-image.js file in the root directory to the js file you created yourself.

2.Import

  • Import using ES6: import uploadImg from 'js-upload-image' (You can choose the name according to your preferences when importing, temporarily use uploadImg).

3.API

The calling method and parameters are described as follows:

uploadImg.start({
    event:event, // event object in the onchange event of input
    url:'', // The address to upload
    params:{}, // Uploads the carried parameter
    callback:(res)=>{}, // The uploaded callback function
	dataType:'',  // The result data type, default 'json'
    withCredentials:false, // whether the request carries a cookie, the default is not
    imgMaxSize:1024 * 1024 * 10, // Maximum size allowed for image upload, default 10M
    imgShouldCompressSize:1024 * 200 // When the image size is greater than imgShouldCompressSize to compress, default 200k
})
1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago