Gathering detailed insights and metrics for shx-cordova-saveb64-image
Gathering detailed insights and metrics for shx-cordova-saveb64-image
Gathering detailed insights and metrics for shx-cordova-saveb64-image
Gathering detailed insights and metrics for shx-cordova-saveb64-image
Cordova plugin to save base64 data as a png image into the device
npm install shx-cordova-saveb64-image
Typescript
Module System
Node Version
NPM Version
71.6
Supply Chain
98.8
Quality
75.8
Maintenance
100
Vulnerability
100
License
Java (33.74%)
Objective-C (30.75%)
JavaScript (23.78%)
C# (11.73%)
Built with Next.js • Fully responsive • SEO optimized • Open source ready
Total Downloads
11,575
Last Day
1
Last Week
69
Last Month
82
Last Year
833
MIT License
1 Stars
149 Commits
2 Watchers
2 Branches
1 Contributors
Updated on Jan 16, 2023
Latest Version
1.0.201
Package Id
shx-cordova-saveb64-image@1.0.201
Size
10.15 kB
NPM Version
3.10.10
Node Version
6.10.2
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
6,800%
69
Compared to previous week
Last Month
105%
82
Compared to previous month
Last Year
93.7%
833
Compared to previous year
This plugin (based on devgeeks/Canvas2ImagePlugin) allows you to save base64 data as a png/jpg image into the device (iOS Photo Library, Android Gallery or WindowsPhone 8 Photo Album).
The plugin is a kind of fork of the Nexxa/cordova-base64-to-gallery/ but with a cleaner history and some extra features - like supporting saving into JPG, sending parameters in an easier way, etc.
In this fork, the Android and iOS implementation were adapted but the WP8 cannot save images in PNG or reducing the quality of the images.
Call the window.imageSaver.saveBase64Image()
method using success and error callbacks and the passing the image's base64 in the options JSON:
window.imageSaver.saveBase64Image(options [,success, fail])
Param | Type | Default | Description |
---|---|---|---|
options | object | *see below | options |
success | function | console.log | success callback |
fail | function | console.error | fail callback |
data
Base64 input String.
prefix
Saved file name prefix. Only works in Android and WP8.
Default: "img_"
mediaScanner
Android Media Scanner after file creation enabled or not. Only works in Android!
Default: true
format
Format to save the image. Allowed values 'JPG' and 'PNG'. Only supported for Android and iOS. Currently this option is ignored on Windows implementation.
Default: JPG
quality
Quality of the saved image. If you want to reduce the quality of the image, you are allow to do it. The value should be a number from 1 to 100. Only supported for Android and iOS. Currently this option is ignored on Windows implementation.
Default: 100
1function onDeviceReady() { 2 var params = {data: base64String, prefix: 'myPrefix_', format: 'JPG', quality: 80, mediaScanner: true}; 3 window.imageSaver.saveBase64Image(params, 4 function (filePath) { 5 console.log('File saved on ' + filePath); 6 }, 7 function (msg) { 8 console.error(msg); 9 } 10 ); 11}
Call the window.imageSaver.removeImageFromLibrary()
method using success and error callbacks and the passing the image URL in the options JSON:
window.imageSaver.removeImageFromLibrary(options [,success, fail])
Param | Type | Default | Description |
---|---|---|---|
options | object | *see below | options |
success | function | console.log | success callback |
fail | function | console.error | fail callback |
data
File path input String.
1function onDeviceReady() { 2 var params = {data: "/data/data/test.png"}; 3 window.imageSaver.removeImageFromLibrary(params, 4 function (filePath) { 5 console.log('File removed from ' + filePath); 6 }, 7 function (msg) { 8 console.error(msg); 9 } 10 ); 11}
No vulnerabilities found.