Skip to content

Commit e6e29e3

Browse files
committed
update readme
add cdn url
1 parent 7f0f512 commit e6e29e3

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

README.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,39 @@
11
# Browser Image Compression #
22
[![npm](https://img.shields.io/npm/v/browser-image-compression.svg)](https://www.npmjs.com/package/browser-image-compression)
3-
[![npm](https://img.shields.io/npm/l/browser-image-compression.svg)](https://www.npmjs.com/package/browser-image-compression)
3+
[![npm](https://img.shields.io/npm/l/browser-image-compression.svg)](https://github.com/Donaldcwl/browser-image-compression)
44

55
Javascript module to be run in the web browser for image compression.
6-
You can use this module to compress jpeg and png image by reducing **resolution** or **storage size** before uploading to application server to save bandwidth.
6+
7+
## Features ##
8+
- You can use this module to compress jpeg and png image by reducing **resolution** or **storage size** before uploading to application server to save bandwidth.
79

810
## Install ##
11+
You can download imageCompression from the [dist folder][dist]. Alternatively, you can install it via yarn or npm
912
```
1013
npm install browser-image-compression --save
1114
or
1215
yarn add browser-image-compression
1316
```
17+
or use a CDN like [delivrjs]:
18+
```
19+
https://cdn.jsdelivr.net/npm/browser-image-compression@0.0.4/dist/browser-image-compression.js
20+
```
1421

1522
## How to use this module in your project? ##
1623
#### Use as ES module ####
1724

1825
(can be used in framework like React, Angular, Vue etc)
1926

2027
(work with bundler like webpack and rollup)
21-
```javascript
28+
```javascriptx
2229
import imageCompression from 'browser-image-compression';
2330
```
2431

2532
or
2633

2734
#### In html file ####
2835
```html
29-
<script type="text/javascript" src="path/to/dist/browser-image-compression.js"></script>
36+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/browser-image-compression@0.0.4/dist/browser-image-compression.js"></script>
3037
```
3138

3239
## API ##
@@ -93,4 +100,14 @@ async function handleImageUpload(event) {
93100
| IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions| last 2 versions| last 2 versions
94101

95102
## Example ##
96-
Please check the "example" folder in this repo
103+
Please check the "[example]" folder in this repo
104+
- How to run the example:
105+
```bash
106+
git clone https://github.com/Donaldcwl/browser-image-compression.git
107+
cd browser-image-compression/example
108+
# open "basic.html" on your browser
109+
```
110+
111+
[dist]: https://github.com/Donaldcwl/browser-image-compression/tree/master/dist
112+
[example]: https://github.com/Donaldcwl/browser-image-compression/tree/master/example
113+
[delivrjs]: https://cdn.jsdelivr.net/

example/basic.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@
4646
}
4747
</script>
4848
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
49-
<script type="text/javascript" src="../dist/browser-image-compression.js"></script>
49+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/browser-image-compression@0.0.4/dist/browser-image-compression.js"></script>
5050
</body>
5151
</html>

0 commit comments

Comments
 (0)