2016-11-18 06:44:27 +00:00
|
|
|
package thumbnail
|
|
|
|
|
|
|
|
import (
|
2016-12-05 08:48:48 +00:00
|
|
|
"errors"
|
2016-11-18 06:44:27 +00:00
|
|
|
"strings"
|
2016-12-05 08:48:48 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
ErrInvalidOption error = errors.New("Invalid format parameter")
|
|
|
|
ErrUnsupportedFiletype error = errors.New("Unsupported filetype")
|
|
|
|
)
|
|
|
|
|
2018-06-09 04:25:16 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|