thumbnail/Thumbnailer.go

28 lines
518 B
Go
Raw Normal View History

2016-11-18 06:44:27 +00:00
package thumbnail
import (
"errors"
2016-11-18 06:44:27 +00:00
"strings"
)
var (
ErrInvalidOption error = errors.New("Invalid format parameter")
ErrUnsupportedFiletype error = errors.New("Unsupported filetype")
)
type Thumbnailer interface {
RenderFile(absPath string) ([]byte, error)
2016-11-18 06:44:27 +00:00
}
2016-12-05 06:47:24 +00:00
func FiletypeSupported(ext string) bool {
switch strings.ToLower(ext) {
2018-06-09 00:25:27 +00:00
case
".jpg", ".jpeg", ".png", ".gif",
".avi", ".mkv", ".mp4", ".ogm", ".wmv", ".flv", ".rm", ".rmvb",
".bmp", ".webp":
2016-12-05 06:47:24 +00:00
return true
default:
return false
}
}