-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from hanagejet/doc
update doc
- Loading branch information
Showing
2 changed files
with
34 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
## v1.0.0 | ||
|
||
### Update | ||
|
||
- First major release | ||
- Change to typescript | ||
|
||
### Breakeng Change | ||
|
||
I am so sorry for those who used the previous version, this update is not compatible. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,41 @@ | ||
[![Build Status](https://travis-ci.org/hanagejet/exif-rotate-js.svg?branch=master)](https://travis-ci.org/hanagejet/exif-rotate-js) | ||
# exif-rotate-js ・ [![CircleCI](https://circleci.com/gh/hanagejet/exif-rotate-js.svg?style=svg)](https://circleci.com/gh/hanagejet/exif-rotate-js) | ||
|
||
# exif-rotate-js | ||
When you use input file, you can get base64 string as array without worrying about `orientation` of exif. | ||
|
||
When you use input file, you can see preview images. | ||
## Usage | ||
|
||
## WHAT'S THIS MODULE | ||
|
||
- preview on file upload images. | ||
- use file API, correct to mobile. | ||
- resize image's file size and size. | ||
|
||
## HOW DOES IT WORK? | ||
|
||
``` | ||
npm install exif-rotate-js | ||
``` | ||
|
||
When you need detail, please see [example page](https://github.com/hanagejet/exif-rotate-js/tree/master/example). | ||
|
||
## METHODS | ||
|
||
### showPreviewImage | ||
|
||
```js | ||
showPreviewImage(file, options); | ||
$ npm install exif-rotate-js | ||
``` | ||
|
||
Can show preview image. | ||
|
||
<img src="https://cloud.githubusercontent.com/assets/4067007/19226722/fc509f20-8e63-11e6-86a0-392a06ec887d.png" width="320"> | ||
|
||
|
||
### getBase64String | ||
## getBase64Strings(files, {maxSize}) | ||
|
||
```js | ||
getBase64String(file, options); | ||
``` | ||
### `return` | ||
|
||
Can get base64 encode string. | ||
`return` is string of base64 array like `["data:image/jpeg;base64,/9j/4AAQS..."]` | ||
|
||
<img src="https://cloud.githubusercontent.com/assets/4067007/19226758/92e519fc-8e64-11e6-8fd4-20556ae6dbb8.png" width="500"> | ||
### `files` | ||
|
||
### Arguments | ||
`files` is input target files. User can select multiple files. | ||
|
||
| Name | Type | Description | | ||
| ------------- |:--------:|:-------------:| | ||
| file | fileList | Just write event target files when input file event | | ||
| options | Object | [Method options.](#options) | | ||
### `maxSize` | ||
|
||
### Options | ||
default: 720 | ||
|
||
See `src/configs.js` | ||
`maxSize` is canvas max size. When image's width is greater than height, `maxSize` applies to width. And vice versa. | ||
|
||
#### max_size | ||
- Type: number | ||
- Default: 720 | ||
## Example | ||
|
||
This is max image size. Can get the size you want. | ||
```js | ||
import { getBase64Strings } from 'exif-rotate-js/lib'; | ||
|
||
#### default_container_id | ||
- Type: string | ||
- Default: container | ||
const elem = document.getElementById('fileImage'); | ||
|
||
This is container element id that is append preview image. | ||
if (elem) { | ||
elem.onchange = async e => { | ||
if (!e.target) return; | ||
const data = await getBase64Strings(e.target.files, { maxSize: 1024 }); | ||
console.log(data); // ["data:image/jpeg;base64,/9j/4AAQS..."] as type of Array | ||
}; | ||
} | ||
``` |