@sitelintcode/optimize-image-on-the-client-side 0.0.18 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Optimize image on the client side
|
|
2
|
+
|
|
3
|
+
Optimize image after selecting using `<input type="file">`. The optimization process takes place in the background and it's done automatically.
|
|
4
|
+
|
|
5
|
+
**Note that images that are larger in size after compression are not taken into account.**
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
* Compressing by the browser, client-side. No image is sent outside of the browser anywhere.
|
|
10
|
+
* When compression takes more than 1 second then the user will see a busy indicator.
|
|
11
|
+
|
|
12
|
+
## Demo
|
|
13
|
+
|
|
14
|
+
[Optimize image on the client side](https://www.sitelint.com/lab/optimize-image-on-the-client-side/)
|
|
15
|
+
|
|
16
|
+
## Benefits
|
|
17
|
+
|
|
18
|
+
* Faster uploading and downloading data.
|
|
19
|
+
* Reducing memory consumption.
|
|
20
|
+
* Saves the space on the server.
|
|
21
|
+
|
|
22
|
+
## Getting started
|
|
23
|
+
|
|
24
|
+
### NPM
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install @sitelintcode/optimize-image-on-the-client-side --save
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## TypeScript
|
|
31
|
+
|
|
32
|
+
```TypeScript
|
|
33
|
+
import { OptimizeImage } from '@sitelintcode/optimize-image-on-the-client-side';
|
|
34
|
+
|
|
35
|
+
const optimizeImage: OptimizeImage = new OptimizeImage();
|
|
36
|
+
|
|
37
|
+
optimizeImage.install();
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Browser environment
|
|
41
|
+
|
|
42
|
+
```HTML
|
|
43
|
+
<script src="https://cdn.jsdelivr.net/npm/@sitelintcode/optimize-image-on-the-client-side@0.0.18/dist/optimize-image-on-the-client-side.js"></script>
|
|
44
|
+
<script>
|
|
45
|
+
(function() {
|
|
46
|
+
const optimizeImage = new window.sitelint.OptimizeImage();
|
|
47
|
+
optimizeImage.install();
|
|
48
|
+
}())
|
|
49
|
+
</script>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Notes
|
|
53
|
+
|
|
54
|
+
Note the version number in the jsdelivr URL: **0.0.18**. Don't forget to set desired version. You may check releases: https://github.com/sitelint/optimize-image-on-the-client-side/releases
|
|
55
|
+
|
|
56
|
+
Worth to mention that [jsdelivr](https://www.jsdelivr.com) suggests:
|
|
57
|
+
|
|
58
|
+
> Omit the version completely or use latest to load the latest one (not recommended for production usage).
|
|
59
|
+
|
|
60
|
+
## Technical
|
|
61
|
+
|
|
62
|
+
1. `import { terser } from "rollup-plugin-terser";` was replaced with `import { terser } from "rollup-plugin-minification";` because `rollup-plugin-terser` is not compatible with Rollup 3.x version. See: https://github.com/TrySound/rollup-plugin-terser/issues/119
|
|
63
|
+
|
|
64
|
+
## Contributing
|
|
65
|
+
|
|
66
|
+
Contributions are welcome, and greatly appreciated! Contributing doesn't just mean submitting pull requests. There are many different ways for you to get involved, including answering questions on the issues, reporting or triaging bugs, and participating in the features evolution process.
|
|
67
|
+
|
|
68
|
+
## License
|
|
69
|
+
|
|
70
|
+
MOZILLA PUBLIC LICENSE, VERSION 2.0
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@sitelintcode/optimize-image-on-the-client-side",
|
|
3
3
|
"description": "Optimize image on the client side",
|
|
4
4
|
"author": "Cezary Tomczyk <cezary.tomczyk@gmail.com> (https://www.sitelint.com/)",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.19",
|
|
6
6
|
"license": "MOZILLA PUBLIC LICENSE, VERSION 2.0",
|
|
7
7
|
"node": ">=16",
|
|
8
8
|
"main": "dist/optimize-image-on-the-client-side.js",
|