1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2024-11-24 08:12:38 +02:00

Add X-Result-Width and X-Result-Height to debug headers

This commit is contained in:
DarthSim 2022-04-18 16:45:34 +06:00
parent 8dddd660d3
commit 91a3671f9d
4 changed files with 7 additions and 0 deletions

View File

@ -4,6 +4,7 @@
### Add
- Add support of RLE-encoded BMP.
- Add `IMGPROXY_ENFORCE_THUMBNAIL` config and [enforce_thumbnail](https://docs.imgproxy.net/generating_the_url?id=enforce-thumbnail) processing option.
- Add `X-Result-Width` and `X-Result-Height` to debug headers.
### Change
- Use thumbnail embedded to HEIC/AVIF if its size is larger than or equal to the requested.

View File

@ -49,6 +49,8 @@ echo $(xxd -g 2 -l 64 -p /dev/random | tr -d '\n')
* `X-Origin-Content-Length`: the size of the source image
* `X-Origin-Width`: the width of the source image
* `X-Origin-Height`: the height of the source image
* `X-Result-Width`: the width of the resultant image
* `X-Result-Height`: the height of the resultant image
* `IMGPROXY_SERVER_NAME`: <i class='badge badge-pro'></i> the `Server` header value. Default: `imgproxy`
## Security

View File

@ -282,6 +282,8 @@ func ProcessImage(ctx context.Context, imgdata *imagedata.ImageData, po *options
}
outData.Headers["X-Origin-Width"] = strconv.Itoa(originWidth)
outData.Headers["X-Origin-Height"] = strconv.Itoa(originHeight)
outData.Headers["X-Result-Width"] = strconv.Itoa(img.Width())
outData.Headers["X-Result-Height"] = strconv.Itoa(img.Height())
}
return outData, err

View File

@ -112,6 +112,8 @@ func respondWithImage(reqID string, r *http.Request, rw http.ResponseWriter, sta
rw.Header().Set("X-Origin-Content-Length", strconv.Itoa(len(originData.Data)))
rw.Header().Set("X-Origin-Width", resultData.Headers["X-Origin-Width"])
rw.Header().Set("X-Origin-Height", resultData.Headers["X-Origin-Height"])
rw.Header().Set("X-Result-Width", resultData.Headers["X-Result-Width"])
rw.Header().Set("X-Result-Height", resultData.Headers["X-Result-Height"])
}
rw.Header().Set("Content-Length", strconv.Itoa(len(resultData.Data)))