Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 7dafc03

Browse filesBrowse files
committed
[[ Bug 22763 ]] Fix resizing mobilePickPhoto for API Level < 24
This patch ensures that calling mobilePickPhoto with width and height params works in older Android versions too. Previously, a constructor for "ExifInterface" was used, that was available in API 24+ (Android 7+). This patch checks the Android version of the device and uses a different constructor on Android < 7.
1 parent cd7d1b7 commit 7dafc03
Copy full SHA for 7dafc03

File tree

Expand file treeCollapse file tree

2 files changed

+13
-3
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+13
-3
lines changed

‎docs/notes/bugfix-22763.md

Copy file name to clipboard
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Ensure mobilePickPhoto with width and height params works on older Android versions

‎engine/src/java/com/runrev/android/Engine.java

Copy file name to clipboardExpand all lines: engine/src/java/com/runrev/android/Engine.java
+12-3Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2232,9 +2232,18 @@ else if (resultCode == Activity.RESULT_OK)
22322232
float t_width = t_bitmap.getWidth();
22332233
float t_height = t_bitmap.getHeight();
22342234

2235-
InputStream t_exif_in = ((LiveCodeActivity)getContext()).getContentResolver().openInputStream(t_photo_uri);
2236-
2237-
ExifInterface t_exif = new ExifInterface(t_exif_in);
2235+
/* In API Level >= 24, you have to use an input stream to make sure that access
2236+
* to a photo in the library is granted. Before that you can just open the photo's
2237+
* file direct. */
2238+
ExifInterface t_exif;
2239+
if (Build.VERSION.SDK_INT >= 24)
2240+
{
2241+
t_exif = new ExifInterface(t_in);
2242+
}
2243+
else
2244+
{
2245+
t_exif = new ExifInterface(t_photo_uri.getPath());
2246+
}
22382247

22392248
int t_orientation = t_exif.getAttributeInt(ExifInterface.TAG_ORIENTATION,
22402249
ExifInterface.ORIENTATION_NORMAL);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.