Fix image type build error
This commit is contained in:
parent
74381ef59e
commit
fff72b61df
@ -43,13 +43,14 @@ object ImageUtil {
|
|||||||
fun findImageType(stream: InputStream): ImageType? {
|
fun findImageType(stream: InputStream): ImageType? {
|
||||||
try {
|
try {
|
||||||
return when (getImageType(stream)?.format) {
|
return when (getImageType(stream)?.format) {
|
||||||
// TODO: image-decoder library currently doesn't detect this
|
// TODO: image-decoder library currently doesn't actually detect AVIF yet
|
||||||
// Format.Avif -> ImageType.AVIF
|
Format.Avif -> ImageType.AVIF
|
||||||
Format.Gif -> ImageType.GIF
|
Format.Gif -> ImageType.GIF
|
||||||
Format.Heif -> ImageType.HEIF
|
Format.Heif -> ImageType.HEIF
|
||||||
Format.Jpeg -> ImageType.JPEG
|
Format.Jpeg -> ImageType.JPEG
|
||||||
Format.Png -> ImageType.PNG
|
Format.Png -> ImageType.PNG
|
||||||
Format.Webp -> ImageType.WEBP
|
Format.Webp -> ImageType.WEBP
|
||||||
|
else -> null
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
}
|
}
|
||||||
@ -89,7 +90,7 @@ object ImageUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum class ImageType(val mime: String, val extension: String) {
|
enum class ImageType(val mime: String, val extension: String) {
|
||||||
// AVIF("image/avif", "avif"),
|
AVIF("image/avif", "avif"),
|
||||||
GIF("image/gif", "gif"),
|
GIF("image/gif", "gif"),
|
||||||
HEIF("image/heif", "heif"),
|
HEIF("image/heif", "heif"),
|
||||||
JPEG("image/jpeg", "jpg"),
|
JPEG("image/jpeg", "jpg"),
|
||||||
|
Loading…
Reference in New Issue
Block a user