Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c0b74c2a75 | ||
|
|
80aa06a6a1 | ||
|
|
771674d948 | ||
|
|
51093d00b8 | ||
|
|
ee4e96a1da | ||
|
|
8590d54633 | ||
|
|
fa0558ea75 | ||
|
|
d270bcb1a6 |
@@ -1,4 +1,4 @@
|
||||
# Cordova base64ToGallery Plugin
|
||||
# :warning: DISCONTINUED - Cordova base64ToGallery Plugin
|
||||
This plugin (based on [devgeeks/Canvas2ImagePlugin](http://github.com/devgeeks/Canvas2ImagePlugin)) allows you to save base64 data as a png image into the device (iOS Photo Library, Android Gallery or WindowsPhone 8 Photo Album).
|
||||
|
||||
The plugin is a kind of fork of the [solderzzc/Base64ImageSaverPlugin](https://github.com/solderzzc/Base64ImageSaverPlugin) but with a cleaner history (a.k.a: no tags from Canvas2ImagePlugin repo) and a newer iOS implementation.
|
||||
|
||||
1196
package-lock.json
generated
Normal file
1196
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cordova-base64-to-gallery",
|
||||
"version": "4.1.2",
|
||||
"version": "4.1.3",
|
||||
"description": "Cordova plugin to save base64 data as a png image into the device",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plugin xmlns:android="http://schemas.android.com/apk/res/android" xmlns="http://www.phonegap.com/ns/plugins/1.0" id="cordova-base64-to-gallery" version="4.1.2">
|
||||
<plugin xmlns:android="http://schemas.android.com/apk/res/android" xmlns="http://www.phonegap.com/ns/plugins/1.0" id="cordova-base64-to-gallery" version="4.1.3">
|
||||
|
||||
<engines>
|
||||
<engine name="cordova-ios" version=">=3.8.0" />
|
||||
|
||||
@@ -62,7 +62,13 @@
|
||||
if(cameraRoll){
|
||||
// add the image to camera roll
|
||||
UIImage * savedImage = [UIImage imageWithContentsOfFile:imagePath];
|
||||
UIImageWriteToSavedPhotosAlbum(savedImage, self, @selector(thisImage:hasBeenSavedInPhotoAlbumWithError:usingContextInfo:), nil);
|
||||
UIImageWriteToSavedPhotosAlbum(savedImage, self,
|
||||
@selector(thisImage:hasBeenSavedInPhotoAlbumWithError:onImagePath:),
|
||||
(void *) CFBridgingRetain(imagePath));
|
||||
} else {
|
||||
// send back the image path of the saved image
|
||||
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:imagePath];
|
||||
[self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId];
|
||||
}
|
||||
|
||||
}else{
|
||||
@@ -79,14 +85,18 @@
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)thisImage:(UIImage *)image hasBeenSavedInPhotoAlbumWithError:(NSError *)error usingContextInfo:(void*)ctxInfo{
|
||||
if (error) {
|
||||
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Error saving Image to Gallery, check Permissions"];
|
||||
[self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId];
|
||||
} else {
|
||||
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString: @"Image Saved to Gallery"];
|
||||
[self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId];
|
||||
-(void)thisImage:(UIImage *)image hasBeenSavedInPhotoAlbumWithError:(NSError *)error onImagePath:(void*)bridgedImagePath{
|
||||
if (error) {
|
||||
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Error saving Image to Gallery, check Permissions"];
|
||||
[self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId];
|
||||
} else {
|
||||
// retrieve bridged image path and release it to get the image path
|
||||
NSString *imagePath = (NSString *) CFBridgingRelease(bridgedImagePath);
|
||||
|
||||
// send the image path back to the js callback
|
||||
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:imagePath];
|
||||
[self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user