mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-05-03 00:32:40 +02:00
add support for specifying output image format
For now, the options are "jpeg" and "png". Gif is a little harder to support because of the way we use the image/gif package to handle animated gifs. I have also have trouble imagining someone wanting to use gif over png. But if the need really exists, we can address it when it comes up. Fixes #89
This commit is contained in:
parent
2937bf84f6
commit
b9cc9df4b6
4 changed files with 37 additions and 8 deletions
|
|
@ -306,7 +306,10 @@ func (t *TransformingTransport) RoundTrip(req *http.Request) (*http.Response, er
|
|||
// replay response with transformed image and updated content length
|
||||
buf := new(bytes.Buffer)
|
||||
fmt.Fprintf(buf, "%s %s\n", resp.Proto, resp.Status)
|
||||
resp.Header.WriteSubset(buf, map[string]bool{"Content-Length": true})
|
||||
resp.Header.WriteSubset(buf, map[string]bool{
|
||||
"Content-Length": true,
|
||||
"Content-Type": opt.Format != "",
|
||||
})
|
||||
fmt.Fprintf(buf, "Content-Length: %d\n\n", len(img))
|
||||
buf.Write(img)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue