status-go/protocol/images/type.go

22 lines
468 B
Go
Raw Normal View History

package images
import (
"github.com/status-im/status-go/images"
"github.com/status-im/status-go/protocol/protobuf"
)
2020-10-26 13:01:46 +00:00
func ImageType(buf []byte) protobuf.ImageType {
switch images.GetFileType(buf){
case images.JPEG:
2020-10-26 13:01:46 +00:00
return protobuf.ImageType_JPEG
case images.PNG:
2020-10-26 13:01:46 +00:00
return protobuf.ImageType_PNG
case images.GIF:
2020-10-26 13:01:46 +00:00
return protobuf.ImageType_GIF
case images.WEBP:
2020-10-26 13:01:46 +00:00
return protobuf.ImageType_WEBP
default:
2020-10-26 13:01:46 +00:00
return protobuf.ImageType_UNKNOWN_IMAGE_TYPE
}
}