mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-05-02 00:02:39 +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
|
|
@ -308,7 +308,8 @@ func (t *TransformingTransport) RoundTrip(req *http.Request) (*http.Response, er
|
|||
fmt.Fprintf(buf, "%s %s\n", resp.Proto, resp.Status)
|
||||
resp.Header.WriteSubset(buf, map[string]bool{
|
||||
"Content-Length": true,
|
||||
"Content-Type": opt.Format != "",
|
||||
// exclude Content-Type header if the format may have changed during transformation
|
||||
"Content-Type": opt.Format != "" || resp.Header.Get("Content-Type") == "image/webp",
|
||||
})
|
||||
fmt.Fprintf(buf, "Content-Length: %d\n\n", len(img))
|
||||
buf.Write(img)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue