Add PNG and JPEG to WebP transcoding
WebP lossy mode offers up to 30% better compression than JPEG.
This commit is contained in:
15
transcoder/util.go
Normal file
15
transcoder/util.go
Normal file
@ -0,0 +1,15 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user