Socket
Socket
Sign inDemoInstall

cordova-plugin-save-image

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-plugin-save-image - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

2

package.json
{
"name": "cordova-plugin-save-image",
"version": "0.1.0",
"version": "0.2.0",
"cordova": {

@@ -5,0 +5,0 @@ "id": "cordova-plugin-save-image",

SaveImage
======
This plugin allows you to save local image files to the iOS Camera Roll/Photo Library or Android Gallery.
This plugin allows you to save local JPEG image files to the iOS Camera Roll/Photo Library or Android Gallery. Other image mime types are currently not supported.
The image file to be saved to the Library/Gallery must be available on the device.

@@ -31,5 +32,5 @@ The plugin is based on code seen in several other existing plugins:

Save an image to the device gallery / camera roll.
Save a local JPEG image to the device gallery / camera roll.
cordova.plugins.imagesaver.saveImageToGallery(nativePathToImage, successCallback, errorCallback);
cordova.plugins.imagesaver.saveImageToGallery(nativePathToJpegImage, successCallback, errorCallback);

@@ -44,7 +45,13 @@ Supported Platforms

Call the `window.cordova.plugins.ImageSaver.saveImageToGallery()` method passing 3 parameters: 1. The native image path for the image to be saved, 2. success callback, 3. error callback:
Call the `window.cordova.plugins.ImageSaver.saveImageToGallery()` method passing 3 parameters: 1. The native image path for the image to be saved, 2. success callback, 3. error callback
### Example
```
window.cordova.plugins.imagesaver.saveImageToGallery(nativePathToImage, onSaveImageSuccess, onSaveImageError);
// iOS with file prefix: var nativePathToJpegImage = 'file:///var/mobile/Containers/Data/Application/<UUID>/Library/NoCloud/some_dir/some_image.jpg'
// iOS without file prefix: var nativePathToJpegImage = '/var/mobile/Containers/Data/Application/<UUID>/Library/NoCloud/some_dir/some_image.jpg'
// Android with file prefix: var nativePathToJpegImage = 'file:///data/data/<package_name>/files/some_dir/some_image.jpg'
// Android without file prefix: var nativePathToJpegImage = '/data/data/<package_name>/files/some_dir/some_image.jpg'
window.cordova.plugins.imagesaver.saveImageToGallery(nativePathToJpegImage, onSaveImageSuccess, onSaveImageError);

@@ -51,0 +58,0 @@ function onSaveImageSuccess() {

@@ -13,5 +13,13 @@ var ImageSaver = function () {

return cordova.exec(successCallback, failureCallback, 'SaveImage', 'saveImageToGallery', [localImagePath]);
return cordova.exec(
successCallback, failureCallback, 'SaveImage', 'saveImageToGallery', [_getLocalImagePathWithoutPrefix()]);
function _getLocalImagePathWithoutPrefix() {
if (localImagePath.startsWith('file:///')) {
return localImagePath.substring(7);
}
return localImagePath;
}
};
module.exports = ImageSaver;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc