rotate avatars

This commit is contained in:
iNPUTmice 2014-09-02 11:19:05 +02:00
parent 6045bcc2eb
commit f888b167c6
1 changed files with 16 additions and 9 deletions

View File

@ -201,17 +201,20 @@ public class FileBackend {
private int getRotation(Uri image) {
if ("content".equals(image.getScheme())) {
try {
Cursor cursor = context
.getContentResolver()
.query(image,
new String[] { MediaStore.Images.ImageColumns.ORIENTATION },
null, null, null);
if (cursor.getCount() != 1) {
return -1;
}
cursor.moveToFirst();
return cursor.getInt(0);
} catch (IllegalArgumentException e) {
return -1;
}
} else {
ExifInterface exif;
try {
@ -376,6 +379,10 @@ public class FileBackend {
if (input == null) {
return null;
} else {
int rotation = getRotation(image);
if (rotation > 0) {
input = rotate(input, rotation);
}
return cropCenterSquare(input, size);
}
} catch (FileNotFoundException e) {