Installations
npm install @picturelink/ngx-image-compress
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
14.2.0
NPM Version
6.14.4
Releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (85.75%)
HTML (12.07%)
JavaScript (1.3%)
SCSS (0.88%)
Developer
Download Statistics
Total Downloads
675
Last Day
1
Last Week
1
Last Month
3
Last Year
75
GitHub Statistics
88 Stars
284 Commits
36 Forks
3 Watching
5 Branches
11 Contributors
Bundle Size
3.75 kB
Minified
1.57 kB
Minified + Gzipped
Package Meta Information
Latest Version
8.0.4-beta.0
Package Id
@picturelink/ngx-image-compress@8.0.4-beta.0
Unpacked Size
203.60 kB
Size
27.84 kB
File Count
26
NPM Version
6.14.4
Node Version
14.2.0
Total Downloads
Cumulative downloads
Total Downloads
675
Last day
0%
1
Compared to previous day
Last week
-50%
1
Compared to previous week
Last month
0%
3
Compared to previous month
Last year
-71.3%
75
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Peer Dependencies
2
ngx-image-compress
Angular utility for compressing images to a satisfying size, that you can choose
Import
1npm i ngx-image-compress
Usage
Example here: https://stackblitz.com/edit/ngx-compress-sample
Import it in your app module
1import {BrowserModule} from '@angular/platform-browser'; 2import {NgModule} from '@angular/core'; 3 4import {AppComponent} from './app.component'; 5import {NgxImageCompressService} from 'ngx-image-compress'; 6 7@NgModule({ 8 declarations: [AppComponent], 9 imports: [BrowserModule], 10 providers: [NgxImageCompressService], 11 bootstrap: [AppComponent] 12}) 13export class AppModule {}
Use it in your component
1import {Component} from '@angular/core'; 2import {NgxImageCompressService} from 'ngx-image-compress'; 3 4 5@Component({ 6 selector: 'app-root', 7 template: ` 8 <div> 9 <button (click)="compressFile()">Upload and compress Image</button> 10 <img *ngIf="imgResultBeforeCompress" [src]="imgResultBeforeCompress" alt=""> 11 <img *ngIf="imgResultAfterCompress" [src]="imgResultAfterCompress" alt=""> 12 </div> 13 ` 14}) 15export class AppComponent { 16 17 constructor(private imageCompress: NgxImageCompressService) {} 18 19 imgResultBeforeCompress:string; 20 imgResultAfterCompress:string; 21 22 compressFile() { 23 24 this.imageCompress.uploadFile().then(({image, orientation}) => { 25 26 this.imgResultBeforeCompress = image; 27 console.warn('Size in bytes was:', this.imageCompress.byteCount(image)); 28 29 this.imageCompress.compressFile(image, orientation, 50, 50).then( 30 result => { 31 this.imgResultAfterCompress = result; 32 console.warn('Size in bytes is now:', this.imageCompress.byteCount(result)); 33 } 34 ); 35 36 }); 37 38 } 39}
How it's working underwood?
We will use Renderer2, and transform the image multiple time through HTML canvas encrustation. In fact you can use the static version into the library and import renderer by yourself.
Updates
2019/07/01
Update to Angular 8 (angular 7 is enough)
Fix DOC_ORIENTATION import (not a required import)
2019/01/09
Since Angular 6 include its own packaging system, I no longer need my webpack config to build it. Everything is working in angular 7 without complaint now (test app is on github)
2018/10/04
Adding Live example.
Everything is now working and tested but I will make some arrangement to the code in index.ts
before submitting it again to npm
, in order to make it more handy.
2017/12/06
Upload to Github Need some fixes and tests to be use as a static library
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
packaging workflow detected
Details
- Info: Project packages its releases by way of GitHub Actions.: .github/workflows/publish-on-npm.yml:9
Reason
dependency not pinned by hash detected -- score normalized to 4
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/on-merge.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/dfa1234/ngx-image-compress/on-merge.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/on-merge.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/dfa1234/ngx-image-compress/on-merge.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/on-merge.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/dfa1234/ngx-image-compress/on-merge.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/on-pull-request.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/dfa1234/ngx-image-compress/on-pull-request.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/on-pull-request.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/dfa1234/ngx-image-compress/on-pull-request.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-on-npm-view-engine.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/dfa1234/ngx-image-compress/publish-on-npm-view-engine.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-on-npm-view-engine.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/dfa1234/ngx-image-compress/publish-on-npm-view-engine.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish-on-npm-view-engine.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/dfa1234/ngx-image-compress/publish-on-npm-view-engine.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-on-npm.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/dfa1234/ngx-image-compress/publish-on-npm.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-on-npm.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/dfa1234/ngx-image-compress/publish-on-npm.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish-on-npm.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/dfa1234/ngx-image-compress/publish-on-npm.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish-on-npm.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/dfa1234/ngx-image-compress/publish-on-npm.yml/master?enable=pin
- Info: 0 out of 8 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 4 third-party GitHubAction dependencies pinned
- Info: 4 out of 4 npmCommand dependencies pinned
Reason
Found 1/22 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/on-merge.yml:1
- Warn: no topLevel permission defined: .github/workflows/on-pull-request.yml:1
- Warn: no topLevel permission defined: .github/workflows/publish-on-npm-view-engine.yml:1
- Warn: no topLevel permission defined: .github/workflows/publish-on-npm.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 10 are checked with a SAST tool
Reason
30 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc
- Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx
- Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc
- Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp
- Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27
- Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w
- Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-353f-5xf4-qw67
- Warn: Project is vulnerable to: GHSA-c24v-8rfc-w8vw
- Warn: Project is vulnerable to: GHSA-8jhw-289h-jh2g
- Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986 / GHSA-64vr-g452-qvp3
- Warn: Project is vulnerable to: GHSA-9cwx-2883-4wfx
- Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
- Warn: Project is vulnerable to: GHSA-8hc4-vh64-cxmj
Score
3.5
/10
Last Scanned on 2024-12-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More