2020-05-13 13:16:17 +00:00
|
|
|
package images
|
|
|
|
|
|
|
|
import (
|
2020-10-01 16:47:34 +00:00
|
|
|
"github.com/status-im/status-go/images"
|
2020-05-13 13:16:17 +00:00
|
|
|
"github.com/status-im/status-go/protocol/protobuf"
|
|
|
|
)
|
|
|
|
|
|
|
|
func ImageType(buf []byte) protobuf.ImageMessage_ImageType {
|
2020-10-01 16:47:34 +00:00
|
|
|
switch images.GetFileType(buf){
|
|
|
|
case images.JPEG:
|
2020-05-13 13:16:17 +00:00
|
|
|
return protobuf.ImageMessage_JPEG
|
2020-10-01 16:47:34 +00:00
|
|
|
case images.PNG:
|
2020-05-13 13:16:17 +00:00
|
|
|
return protobuf.ImageMessage_PNG
|
2020-10-01 16:47:34 +00:00
|
|
|
case images.GIF:
|
2020-05-13 13:16:17 +00:00
|
|
|
return protobuf.ImageMessage_GIF
|
2020-10-01 16:47:34 +00:00
|
|
|
case images.WEBP:
|
2020-05-13 13:16:17 +00:00
|
|
|
return protobuf.ImageMessage_WEBP
|
2020-05-14 05:40:40 +00:00
|
|
|
default:
|
|
|
|
return protobuf.ImageMessage_UNKNOWN_IMAGE_TYPE
|
2020-05-13 13:16:17 +00:00
|
|
|
}
|
|
|
|
}
|