Fixing crash when image is an SVG and tries to compress.
This commit is contained in:
@@ -69,11 +69,16 @@ class MediaCompressor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
} else if (contentType?.startsWith("image", true) == true && !contentType.contains("gif")) {
|
} else if (contentType?.startsWith("image", true) == true && !contentType.contains("gif") && !contentType.contains("svg")) {
|
||||||
val compressedImageFile = Compressor.compress(applicationContext, from(uri, contentType, applicationContext)) {
|
try {
|
||||||
default(width = 640, format = Bitmap.CompressFormat.JPEG)
|
val compressedImageFile = Compressor.compress(applicationContext, from(uri, contentType, applicationContext)) {
|
||||||
|
default(width = 640, format = Bitmap.CompressFormat.JPEG)
|
||||||
|
}
|
||||||
|
onReady(compressedImageFile.toUri(), contentType, compressedImageFile.length())
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
onReady(uri, contentType, null)
|
||||||
}
|
}
|
||||||
onReady(compressedImageFile.toUri(), contentType, compressedImageFile.length())
|
|
||||||
} else {
|
} else {
|
||||||
onReady(uri, contentType, null)
|
onReady(uri, contentType, null)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user