Android: improved image type detection

pull/41/head
Laurent Cozic 2017-11-20 19:18:49 +00:00
parent c31c7a8a67
commit c6cb2800d7
7 changed files with 11 additions and 2 deletions

BIN
Assets/Icon-Android.psd Normal file

Binary file not shown.

View File

@ -90,8 +90,8 @@ android {
applicationId "net.cozic.joplin"
minSdkVersion 16
targetSdkVersion 22
versionCode 62
versionName "0.10.49"
versionCode 64
versionName "0.10.51"
ndk {
abiFilters "armeabi-v7a", "x86"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

@ -276,6 +276,15 @@ class NoteScreenComponent extends BaseScreenComponent {
mimeType = mimeUtils.fromFileExtension(ext);
}
if (!mimeType && fileType === 'image') {
// Assume JPEG if we couldn't determine the file type. It seems to happen with the image picker
// when the file path is something like content://media/external/images/media/123456
// If the image is not a JPEG, something will throw an error below, but there's a good chance
// it will work.
reg.logger().info('Missing file type and could not detect it - assuming image/jpg');
mimeType = 'image/jpg';
}
reg.logger().info('Got file: ' + localFilePath);
reg.logger().info('Got type: ' + mimeType);