compy/transcoder/util.go
Andrew Gaul 9518dc2f1a Add PNG and JPEG to WebP transcoding
WebP lossy mode offers up to 30% better compression than JPEG.
2017-01-16 00:06:17 -08:00

16 lines
254 B
Go

package transcoder
import (
"net/http"
"strings"
)
func SupportsWebP(headers http.Header) bool {
for _, v := range strings.Split(headers.Get("Accept"), ",") {
if strings.SplitN(v, ";", 2)[0] == "image/webp" {
return true
}
}
return false
}