Browse Source

change naming

master
munir ishak 5 years ago
parent
commit
d0ee32309e

+ 4
- 4
README.md View File

1
-Base64ImageSaverPlugin
1
+Base64SaveImage
2
 ============
2
 ============
3
 
3
 
4
 This plugin(based on devgeeks/Canvas2ImagePlugin) allows you to save BASE64 data to the iOS Photo Library, Android Gallery or WindowsPhone 8 Photo Album from your app.
4
 This plugin(based on devgeeks/Canvas2ImagePlugin) allows you to save BASE64 data to the iOS Photo Library, Android Gallery or WindowsPhone 8 Photo Album from your app.
5
 
5
 
6
-This plugin fork from solderzzc/Base64ImageSaverPlugin
6
+This plugin fork from solderzzc/Base64SaveImage
7
 
7
 
8
 Usage:
8
 Usage:
9
 ------
9
 ------
10
 
10
 
11
-Call the `window.Base64ImageSaverPlugin.saveImageDataToLibrary()` method using success and error callbacks and the id attribute or the element object of the canvas to save:
11
+Call the `window.Base64SaveImage.saveImageDataToLibrary()` method using success and error callbacks and the id attribute or the element object of the canvas to save:
12
 
12
 
13
 ### Example
13
 ### Example
14
 
14
 
15
 ```javascript
15
 ```javascript
16
 function onDeviceReady()
16
 function onDeviceReady()
17
 {
17
 {
18
-	window.Base64ImageSaverPlugin.saveImageDataToLibrary(
18
+	window.Base64SaveImage.saveImageDataToLibrary(
19
         function(msg){
19
         function(msg){
20
             console.log(msg);
20
             console.log(msg);
21
         },
21
         },

+ 1
- 1
package.json View File

1
 {
1
 {
2
   "name": "cordova-mirtech-plugin-base64saveimage",
2
   "name": "cordova-mirtech-plugin-base64saveimage",
3
-  "version": "0.0.2",
3
+  "version": "0.0.5",
4
   "description": "This plugin allows you to save the contents of an HTML canvas tag to the iOS Photo Library, or Android Gallery from your app.",
4
   "description": "This plugin allows you to save the contents of an HTML canvas tag to the iOS Photo Library, or Android Gallery from your app.",
5
   "cordova": {
5
   "cordova": {
6
     "id": "com.mirfalahtech.base64saveimage",
6
     "id": "com.mirfalahtech.base64saveimage",

+ 14
- 14
plugin.xml View File

1
 <plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
1
 <plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
2
     xmlns:android="http://schemas.android.com/apk/res/android"
2
     xmlns:android="http://schemas.android.com/apk/res/android"
3
     id="com.mirfalahtech.base64saveimage"
3
     id="com.mirfalahtech.base64saveimage"
4
-    version="0.0.1">
4
+    version="0.0.5">
5
 
5
 
6
     <name>base64saveimage</name>
6
     <name>base64saveimage</name>
7
 
7
 
15
 
15
 
16
     <license></license>
16
     <license></license>
17
 
17
 
18
-    <js-module src="www/Base64ImageSaverPlugin.js" name="Base64ImageSaverPlugin">
19
-        <clobbers target="window.Base64ImageSaverPlugin" />
18
+    <js-module src="www/Base64SaveImage.js" name="Base64SaveImage">
19
+        <clobbers target="window.Base64SaveImage" />
20
     </js-module>
20
     </js-module>
21
 
21
 
22
     <!-- ios -->
22
     <!-- ios -->
23
     <platform name="ios">
23
     <platform name="ios">
24
         <config-file target="config.xml" parent="/*">
24
         <config-file target="config.xml" parent="/*">
25
-            <feature name="Base64ImageSaverPlugin">
26
-                <param name="ios-package" value="Base64ImageSaverPlugin"/>
25
+            <feature name="Base64SaveImage">
26
+                <param name="ios-package" value="Base64SaveImage"/>
27
                 <param name="onload" value="true" />
27
                 <param name="onload" value="true" />
28
             </feature>
28
             </feature>
29
         </config-file>
29
         </config-file>
30
 
30
 
31
-        <header-file src="src/ios/Base64ImageSaverPlugin.h" />
31
+        <header-file src="src/ios/Base64SaveImage.h" />
32
 
32
 
33
-        <source-file src="src/ios/Base64ImageSaverPlugin.m"
33
+        <source-file src="src/ios/Base64SaveImage.m"
34
             compiler-flags="-fno-objc-arc" />
34
             compiler-flags="-fno-objc-arc" />
35
     </platform>
35
     </platform>
36
 
36
 
42
         </config-file>
42
         </config-file>
43
 
43
 
44
         <config-file target="res/xml/config.xml" parent="/*">
44
         <config-file target="res/xml/config.xml" parent="/*">
45
-          <feature name="Base64ImageSaverPlugin" >
46
-            <param name="android-package" value="org.solderzzc.Base64ImageSaverPlugin.Base64ImageSaverPlugin"/>
45
+          <feature name="Base64SaveImage" >
46
+            <param name="android-package" value="org.solderzzc.Base64SaveImage.Base64SaveImage"/>
47
           </feature>
47
           </feature>
48
         </config-file>
48
         </config-file>
49
 
49
 
50
-        <source-file src="src/android/Base64ImageSaverPlugin.java" 
51
-            target-dir="src/org/solderzzc/Base64ImageSaverPlugin" />
50
+        <source-file src="src/android/Base64SaveImage.java" 
51
+            target-dir="src/org/solderzzc/Base64SaveImage" />
52
 
52
 
53
     </platform>
53
     </platform>
54
 
54
 
55
     <!-- wp8 -->
55
     <!-- wp8 -->
56
     <platform name="wp8">
56
     <platform name="wp8">
57
         <config-file target="config.xml" parent="/*">
57
         <config-file target="config.xml" parent="/*">
58
-            <feature name="Base64ImageSaverPlugin">
59
-                <param name="wp-package" value="Base64ImageSaverPlugin"/>
58
+            <feature name="Base64SaveImage">
59
+                <param name="wp-package" value="Base64SaveImage"/>
60
                 <param name="onload" value="true" />
60
                 <param name="onload" value="true" />
61
             </feature>
61
             </feature>
62
         </config-file>
62
         </config-file>
65
             <Capability Name="ID_CAP_MEDIALIB_PHOTO" />
65
             <Capability Name="ID_CAP_MEDIALIB_PHOTO" />
66
         </config-file>
66
         </config-file>
67
 
67
 
68
-        <source-file src="src/wp8/Base64ImageSaverPlugin.cs" />
68
+        <source-file src="src/wp8/Base64SaveImage.cs" />
69
     </platform>
69
     </platform>
70
 </plugin>
70
 </plugin>

src/android/Base64ImageSaverPlugin.java → src/android/Base64SaveImage.java View File

1
-package org.solderzzc.Base64ImageSaverPlugin;
1
+package org.solderzzc.Base64SaveImage;
2
 
2
 
3
 import java.io.File;
3
 import java.io.File;
4
 import java.io.FileOutputStream;
4
 import java.io.FileOutputStream;
20
 import android.util.Log;
20
 import android.util.Log;
21
 
21
 
22
 /**
22
 /**
23
- * Base64ImageSaverPlugin.java
23
+ * Base64SaveImage.java
24
  *
24
  *
25
- * Android implementation of the Base64ImageSaverPlugin for iOS.
25
+ * Android implementation of the Base64SaveImage for iOS.
26
  * Inspirated by Joseph's "Save HTML5 Canvas Image to Gallery" plugin
26
  * Inspirated by Joseph's "Save HTML5 Canvas Image to Gallery" plugin
27
  * http://jbkflex.wordpress.com/2013/06/19/save-html5-canvas-image-to-gallery-phonegap-android-plugin/
27
  * http://jbkflex.wordpress.com/2013/06/19/save-html5-canvas-image-to-gallery-phonegap-android-plugin/
28
  *
28
  *
29
  * @author Vegard Løkken <vegard@headspin.no>
29
  * @author Vegard Løkken <vegard@headspin.no>
30
  */
30
  */
31
-public class Base64ImageSaverPlugin extends CordovaPlugin {
31
+public class Base64SaveImage extends CordovaPlugin {
32
 	public static final String ACTION = "saveImageDataToLibrary";
32
 	public static final String ACTION = "saveImageDataToLibrary";
33
 
33
 
34
 	@Override
34
 	@Override
79
 					+ c.get(Calendar.SECOND);
79
 					+ c.get(Calendar.SECOND);
80
 
80
 
81
 			String deviceVersion = Build.VERSION.RELEASE;
81
 			String deviceVersion = Build.VERSION.RELEASE;
82
-			Log.i("Base64ImageSaverPlugin", "Android version " + deviceVersion);
82
+			Log.i("Base64SaveImage", "Android version " + deviceVersion);
83
 			int check = deviceVersion.compareTo("2.3.3");
83
 			int check = deviceVersion.compareTo("2.3.3");
84
 
84
 
85
 			File folder;
85
 			File folder;
108
 
108
 
109
 			retVal = imageFile;
109
 			retVal = imageFile;
110
 		} catch (Exception e) {
110
 		} catch (Exception e) {
111
-			Log.e("Base64ImageSaverPlugin", "An exception occured while saving image: "
111
+			Log.e("Base64SaveImage", "An exception occured while saving image: "
112
 					+ e.toString());
112
 					+ e.toString());
113
 		}
113
 		}
114
 		return retVal;
114
 		return retVal;

src/ios/Base64ImageSaverPlugin.h → src/ios/Base64SaveImage.h View File

1
 //
1
 //
2
-//  Base64ImageSaverPlugin.h
3
-//  Base64ImageSaverPlugin PhoneGap/Cordova plugin
2
+//  Base64SaveImage.h
3
+//  Base64SaveImage PhoneGap/Cordova plugin
4
 //
4
 //
5
 //  Created by Tommy-Carlos Williams on 29/03/12.
5
 //  Created by Tommy-Carlos Williams on 29/03/12.
6
 //  Copyright (c) 2012 Tommy-Carlos Williams. All rights reserved.
6
 //  Copyright (c) 2012 Tommy-Carlos Williams. All rights reserved.
10
 
10
 
11
 #import <Cordova/CDVPlugin.h>
11
 #import <Cordova/CDVPlugin.h>
12
 
12
 
13
-@interface Base64ImageSaverPlugin : CDVPlugin
13
+@interface Base64SaveImage : CDVPlugin
14
 {
14
 {
15
 	NSString* callbackId;
15
 	NSString* callbackId;
16
 }
16
 }

src/ios/Base64ImageSaverPlugin.m → src/ios/Base64SaveImage.m View File

1
 //
1
 //
2
-//  Base64ImageSaverPlugin.m
3
-//  Base64ImageSaverPlugin PhoneGap/Cordova plugin
2
+//  Base64SaveImage.m
3
+//  Base64SaveImage PhoneGap/Cordova plugin
4
 //
4
 //
5
 //  Created by Tommy-Carlos Williams on 29/03/12.
5
 //  Created by Tommy-Carlos Williams on 29/03/12.
6
 //  Copyright (c) 2012 Tommy-Carlos Williams. All rights reserved.
6
 //  Copyright (c) 2012 Tommy-Carlos Williams. All rights reserved.
7
 //  MIT Licensed
7
 //  MIT Licensed
8
 //
8
 //
9
 
9
 
10
-#import "Base64ImageSaverPlugin.h"
10
+#import "Base64SaveImage.h"
11
 #import <Cordova/CDV.h>
11
 #import <Cordova/CDV.h>
12
 
12
 
13
-@implementation Base64ImageSaverPlugin
13
+@implementation Base64SaveImage
14
 @synthesize callbackId;
14
 @synthesize callbackId;
15
 
15
 
16
 //-(CDVPlugin*) initWithWebView:(UIWebView*)theWebView
16
 //-(CDVPlugin*) initWithWebView:(UIWebView*)theWebView
17
 //{
17
 //{
18
-//    self = (Base64ImageSaverPlugin*)[super initWithWebView:theWebView];
18
+//    self = (Base64SaveImage*)[super initWithWebView:theWebView];
19
 //    return self;
19
 //    return self;
20
 //}
20
 //}
21
 
21
 

src/wp8/Base64ImageSaverPlugin.cs → src/wp8/Base64SaveImage.cs View File

6
 using WPCordovaClassLib.Cordova.Commands;
6
 using WPCordovaClassLib.Cordova.Commands;
7
 using WPCordovaClassLib.Cordova.JSON;
7
 using WPCordovaClassLib.Cordova.JSON;
8
 
8
 
9
-public class Base64ImageSaverPlugin : BaseCommand
9
+public class Base64SaveImage : BaseCommand
10
 {
10
 {
11
-    public Base64ImageSaverPlugin()
11
+    public Base64SaveImage()
12
 	{
12
 	{
13
 	}
13
 	}
14
 
14
 

www/Base64ImageSaverPlugin.js → www/Base64SaveImage.js View File

1
 //
1
 //
2
-//  Base64ImageSaverPlugin.js
3
-//  Base64ImageSaverPlugin PhoneGap/Cordova plugin
2
+//  Base64SaveImage.js
3
+//  Base64SaveImage PhoneGap/Cordova plugin
4
 //
4
 //
5
 //  Created by Tommy-Carlos Williams on 29/03/12.
5
 //  Created by Tommy-Carlos Williams on 29/03/12.
6
 //  Modified by Simba Zhang on 09/10/2015
6
 //  Modified by Simba Zhang on 09/10/2015
13
     saveImageDataToLibrary:function(successCallback, failureCallback, base64Data) {
13
     saveImageDataToLibrary:function(successCallback, failureCallback, base64Data) {
14
         // successCallback required
14
         // successCallback required
15
         if (typeof successCallback != "function") {
15
         if (typeof successCallback != "function") {
16
-            console.log("Base64ImageSaverPlugin Error: successCallback is not a function");
16
+            console.log("Base64SaveImage Error: successCallback is not a function");
17
         }
17
         }
18
         else if (typeof failureCallback != "function") {
18
         else if (typeof failureCallback != "function") {
19
-            console.log("Base64ImageSaverPlugin Error: failureCallback is not a function");
19
+            console.log("Base64SaveImage Error: failureCallback is not a function");
20
         }
20
         }
21
         else if (typeof base64Data != "string") {
21
         else if (typeof base64Data != "string") {
22
-            console.log("Base64ImageSaverPlugin Error: base64Data is not a string");
22
+            console.log("Base64SaveImage Error: base64Data is not a string");
23
         }
23
         }
24
         else {
24
         else {
25
             var imageData = base64Data.replace(/data:image\/png;base64,/,'');
25
             var imageData = base64Data.replace(/data:image\/png;base64,/,'');
26
-            return cordova.exec(successCallback, failureCallback, "Base64ImageSaverPlugin","saveImageDataToLibrary",[imageData]);
26
+            return cordova.exec(successCallback, failureCallback, "Base64SaveImage","saveImageDataToLibrary",[imageData]);
27
         }
27
         }
28
     }
28
     }
29
   };
29
   };

Loading…
Cancel
Save