You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bo...@apache.org on 2012/06/06 00:50:49 UTC

[4/4] android commit: CB-860: MediaFile.getFormatData broken for Image from Capture

CB-860: MediaFile.getFormatData broken for Image from Capture


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/adfdb16d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/adfdb16d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/adfdb16d

Branch: refs/heads/CordovaWebView
Commit: adfdb16dc5a726ac83d30b6b9daf61ab7c1129df
Parents: 24e5c24
Author: macdonst <si...@gmail.com>
Authored: Tue Jun 5 08:42:17 2012 -0400
Committer: macdonst <si...@gmail.com>
Committed: Tue Jun 5 08:45:33 2012 -0400

----------------------------------------------------------------------
 framework/src/org/apache/cordova/Capture.java   |    3 ++-
 framework/src/org/apache/cordova/FileUtils.java |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/adfdb16d/framework/src/org/apache/cordova/Capture.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/Capture.java b/framework/src/org/apache/cordova/Capture.java
index 9809ed1..1eb0b90 100644
--- a/framework/src/org/apache/cordova/Capture.java
+++ b/framework/src/org/apache/cordova/Capture.java
@@ -148,9 +148,10 @@ public class Capture extends Plugin {
      * @throws JSONException
      */
     private JSONObject getImageData(String filePath, JSONObject obj) throws JSONException {
-        Bitmap bitmap = BitmapFactory.decodeFile(filePath);
+        Bitmap bitmap = BitmapFactory.decodeFile(FileUtils.stripFileProtocol(filePath));
         obj.put("height", bitmap.getHeight());
         obj.put("width", bitmap.getWidth());
+        bitmap.recycle();
         return obj;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/adfdb16d/framework/src/org/apache/cordova/FileUtils.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/FileUtils.java b/framework/src/org/apache/cordova/FileUtils.java
index c7d0280..32d3678 100755
--- a/framework/src/org/apache/cordova/FileUtils.java
+++ b/framework/src/org/apache/cordova/FileUtils.java
@@ -740,7 +740,7 @@ public class FileUtils extends Plugin {
      * @param filePath to be checked.
      * @return
      */
-    private String stripFileProtocol(String filePath) {
+    public static String stripFileProtocol(String filePath) {
         if (filePath.startsWith("file://")) {
             filePath = filePath.substring(7);
         }