add .gif support (single frame)

This commit is contained in:
mappu 2016-12-05 19:08:13 +13:00
parent b149b8e570
commit f7c82a7488
1 changed files with 9 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package thumbnail
import ( import (
"fmt" "fmt"
"image/gif"
"image/jpeg" "image/jpeg"
"image/png" "image/png"
"os" "os"
@ -76,6 +77,14 @@ func (this *Thumbnailer) RenderFile_NoCache(absPath string) ([]byte, error) {
return this.RenderScaledImage(src) return this.RenderScaledImage(src)
case ".gif":
src, err := gif.Decode(fh)
if err != nil {
return nil, err
}
return this.RenderScaledImage(src)
case ".avi", ".mkv", ".mp4", ".ogm", ".wmv": case ".avi", ".mkv", ".mp4", ".ogm", ".wmv":
return this.RenderScaledFfmpeg(absPath) return this.RenderScaledFfmpeg(absPath)