Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.

Commit 44615a7

Browse files
authored
Update README.md
1 parent 3174097 commit 44615a7

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

README.md

+33-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,34 @@
11
# js-client-image-compress
2-
compress and resize image before uploading via browser and transform to base64
2+
Compress and Resize images via browser and transform it to base64.
3+
4+
when i was working on a project, i saw that when i pick some images via fileInput, that image will rotate automatically!
5+
after searching i understood that occures due to EXIF Orientation values.
6+
7+
https://sirv.com/help/resources/rotate-photos-to-be-upright/
8+
9+
finaly i found a function that recognize the EXIF Orientation value.
10+
11+
i combined this function to other functions that does below:
12+
13+
1 - Recognizes EXIF Orientation value.
14+
2 - Fixes Orientation to Original.
15+
3 - Compresses image file size.
16+
4 - Resizes Width & Height
17+
5 - Delivers image as Base64
18+
19+
### How to use:
20+
```javascript
21+
// <input type="file" id='image-picker'/>
22+
23+
document.getElementById('image-picker').onchange = function() {
24+
var file = this.files[0];
25+
proccessImage(file, {
26+
max_width: 1000,
27+
max_height: 1000,
28+
percent: 0.7, // percent of compress
29+
}, function (base64) {
30+
console.log(base64); // get output image as base64
31+
}
32+
);
33+
};
34+
```

0 commit comments

Comments
 (0)