add tiff and webp support

This commit is contained in:
Milan Nikolic
2015-11-03 13:37:02 +01:00
parent dd4c3a2dbf
commit a4c7b87dc0

View File

@@ -46,6 +46,8 @@ import (
_ "github.com/hotei/bmp" _ "github.com/hotei/bmp"
"github.com/nfnt/resize" "github.com/nfnt/resize"
"github.com/skarademir/naturalsort" "github.com/skarademir/naturalsort"
_ "golang.org/x/image/tiff"
_ "golang.org/x/image/webp"
"gopkg.in/alecthomas/kingpin.v2" "gopkg.in/alecthomas/kingpin.v2"
) )
@@ -574,7 +576,7 @@ func getCover(images []string) string {
return images[0] return images[0]
} }
// Checks if file is comic // Checks if file is archive
func isArchive(f string) bool { func isArchive(f string) bool {
var types = []string{".rar", ".zip", ".7z", ".gz", var types = []string{".rar", ".zip", ".7z", ".gz",
".bz2", ".cbr", ".cbz", ".cb7", ".cbt"} ".bz2", ".cbr", ".cbz", ".cb7", ".cbt"}
@@ -599,8 +601,8 @@ func isDocument(f string) bool {
// Checks if file is image // Checks if file is image
func isImage(f string) bool { func isImage(f string) bool {
var types = []string{".jpg", ".jpeg", ".jpe", var types = []string{".jpg", ".jpeg", ".jpe", ".png",
".png", ".gif", ".bmp"} ".gif", ".bmp", ".tiff", ".tif", ".webp"}
for _, t := range types { for _, t := range types {
if strings.ToLower(filepath.Ext(f)) == t { if strings.ToLower(filepath.Ext(f)) == t {
return true return true