mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-04-24 20:36:24 +02:00
add webp support (decode only)
if any transformation is requested, webp images will be encoded and served as jpeg or png, defaulting to jpeg if no format is specified. Fixes #88
This commit is contained in:
parent
b9cc9df4b6
commit
328044540e
3 changed files with 14 additions and 3 deletions
|
|
@ -23,6 +23,7 @@ import (
|
|||
"image/png"
|
||||
|
||||
"github.com/disintegration/imaging"
|
||||
_ "golang.org/x/image/webp" // register webp format
|
||||
"willnorris.com/go/gifresize"
|
||||
)
|
||||
|
||||
|
|
@ -62,7 +63,7 @@ func Transform(img []byte, opt Options) ([]byte, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case "jpeg":
|
||||
case "jpeg", "webp": // default to encoding webp as jpeg
|
||||
quality := opt.Quality
|
||||
if quality == 0 {
|
||||
quality = defaultQuality
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue