mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-22 00:32:55 +08:00
CB-860: MediaFile.getFormatData broken for Image from Capture
This commit is contained in:
parent
24e5c24dd4
commit
adfdb16dc5
@ -148,9 +148,10 @@ public class Capture extends Plugin {
|
|||||||
* @throws JSONException
|
* @throws JSONException
|
||||||
*/
|
*/
|
||||||
private JSONObject getImageData(String filePath, JSONObject obj) 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("height", bitmap.getHeight());
|
||||||
obj.put("width", bitmap.getWidth());
|
obj.put("width", bitmap.getWidth());
|
||||||
|
bitmap.recycle();
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -740,7 +740,7 @@ public class FileUtils extends Plugin {
|
|||||||
* @param filePath to be checked.
|
* @param filePath to be checked.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String stripFileProtocol(String filePath) {
|
public static String stripFileProtocol(String filePath) {
|
||||||
if (filePath.startsWith("file://")) {
|
if (filePath.startsWith("file://")) {
|
||||||
filePath = filePath.substring(7);
|
filePath = filePath.substring(7);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user