Parcourir la source

Fix `X-Result-Height` debug header for animated images

DarthSim il y a 1 mois
Parent
commit
7bdae0fb0a
2 fichiers modifiés avec 4 ajouts et 2 suppressions
  1. 1 0
      CHANGELOG.md
  2. 3 2
      processing/processing.go

+ 1 - 0
CHANGELOG.md

@@ -5,6 +5,7 @@
 - Fix the `Vary` header value when `IMGPROXY_AUTO_JXL` or `IMGPROXY_ENFORCE_JXL` configs are set to `true`.
 - Fix connection break when the `raw` processing option is used and the response status code does not allow a response body (such as `304 Not Modified`).
 - Fix the `If-Modified-Since` request header handling when the `raw` processing option is used.
+- Fix `X-Origin-Height` and `X-Result-Height` debug header values for animated images.
 - (pro) Fix generating thumbnails for VP9 videos with high bit depth.
 - (pro) Fix `IMGPROXY_CUSTOM_RESPONSE_HEADERS` and `IMGPROXY_RESPONSE_HEADERS_PASSTHROUGH` configs behavior when the `raw` processing option is used.
 

+ 3 - 2
processing/processing.go

@@ -361,10 +361,11 @@ func ProcessImage(ctx context.Context, imgdata *imagedata.ImageData, po *options
 		if outData.Headers == nil {
 			outData.Headers = make(map[string]string)
 		}
+		resultWidth, resultHeight := getImageSize(img)
 		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())
+		outData.Headers["X-Result-Width"] = strconv.Itoa(resultWidth)
+		outData.Headers["X-Result-Height"] = strconv.Itoa(resultHeight)
 	}
 
 	return outData, err