2020-05-13 15:16:17 +02:00
|
|
|
package images
|
|
|
|
|
|
|
|
import (
|
2020-10-01 17:47:34 +01:00
|
|
|
"github.com/status-im/status-go/images"
|
2020-05-13 15:16:17 +02:00
|
|
|
"github.com/status-im/status-go/protocol/protobuf"
|
|
|
|
)
|
|
|
|
|
2020-10-26 13:01:46 +00:00
|
|
|
func ImageType(buf []byte) protobuf.ImageType {
|
2020-11-24 23:16:19 +00:00
|
|
|
switch images.GetType(buf) {
|
2020-10-01 17:47:34 +01:00
|
|
|
case images.JPEG:
|
2020-10-26 13:01:46 +00:00
|
|
|
return protobuf.ImageType_JPEG
|
2020-10-01 17:47:34 +01:00
|
|
|
case images.PNG:
|
2020-10-26 13:01:46 +00:00
|
|
|
return protobuf.ImageType_PNG
|
2020-10-01 17:47:34 +01:00
|
|
|
case images.GIF:
|
2020-10-26 13:01:46 +00:00
|
|
|
return protobuf.ImageType_GIF
|
2020-10-01 17:47:34 +01:00
|
|
|
case images.WEBP:
|
2020-10-26 13:01:46 +00:00
|
|
|
return protobuf.ImageType_WEBP
|
2020-05-14 07:40:40 +02:00
|
|
|
default:
|
2020-10-26 13:01:46 +00:00
|
|
|
return protobuf.ImageType_UNKNOWN_IMAGE_TYPE
|
2020-05-13 15:16:17 +02:00
|
|
|
}
|
|
|
|
}
|