Skip to content

Commit

Permalink
Merge pull request #20 from hanagejet/doc
Browse files Browse the repository at this point in the history
update doc
  • Loading branch information
taro-shono authored May 27, 2019
2 parents 1fbd6ee + 7e4c66b commit b984384
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 48 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
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.
72 changes: 24 additions & 48 deletions README.md
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
};
}
```

0 comments on commit b984384

Please sign in to comment.