Fix image type build error

(cherry picked from commit fff72b61dfef494260bbfa544b21be820fbaeafc)
This commit is contained in:
arkon 2021-06-04 23:46:18 -04:00 committed by Jobobby04
parent e017617612
commit 9b85b009a4

View File

@ -45,13 +45,14 @@ object ImageUtil {
fun findImageType(stream: InputStream): ImageType? {
try {
return when (getImageType(stream)?.format) {
// TODO: image-decoder library currently doesn't detect this
// Format.Avif -> ImageType.AVIF
// TODO: image-decoder library currently doesn't actually detect AVIF yet
Format.Avif -> ImageType.AVIF
Format.Gif -> ImageType.GIF
Format.Heif -> ImageType.HEIF
Format.Jpeg -> ImageType.JPEG
Format.Png -> ImageType.PNG
Format.Webp -> ImageType.WEBP
else -> null
}
} catch (e: Exception) {
}
@ -91,7 +92,7 @@ object ImageUtil {
}
enum class ImageType(val mime: String, val extension: String) {
// AVIF("image/avif", "avif"),
AVIF("image/avif", "avif"),
GIF("image/gif", "gif"),
HEIF("image/heif", "heif"),
JPEG("image/jpeg", "jpg"),