mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-10-04 18:33:36 +02:00
Rename IMGPROXY_ENABLE_*_DETECTION
configs to IMGPROXY_AUTO_*
This commit is contained in:
10
CHANGELOG.md
10
CHANGELOG.md
@@ -3,10 +3,14 @@
|
|||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Add
|
### Add
|
||||||
- Add JPEL XL (JXL) support.
|
- Add JPEL XL (JXL) support.
|
||||||
- Add [IMGPROXY_ENABLE_JXL_DETECTION](https://docs.imgproxy.net/latest/configuration/options#IMGPROXY_ENABLE_JXL_DETECTION), [IMGPROXY_ENFORCE_JXL](https://docs.imgproxy.net/latest/configuration/options#IMGPROXY_ENFORCE_JXL), and [IMGPROXY_JXL_EFFORT](https://docs.imgproxy.net/latest/configuration/options#IMGPROXY_JXL_EFFORT) configs.
|
- Add [IMGPROXY_AUTO_JXL](https://docs.imgproxy.net/latest/configuration/options#IMGPROXY_AUTO_JXL), [IMGPROXY_ENFORCE_JXL](https://docs.imgproxy.net/latest/configuration/options#IMGPROXY_ENFORCE_JXL), and [IMGPROXY_JXL_EFFORT](https://docs.imgproxy.net/latest/configuration/options#IMGPROXY_JXL_EFFORT) configs.
|
||||||
- (pro) Add [objects_position](https://docs.imgproxy.net/latest/usage/processing#objects-position) processing and info options.
|
- (pro) Add [objects_position](https://docs.imgproxy.net/latest/usage/processing#objects-position) processing and info options.
|
||||||
- (pro) Add [IMGPROXY_OBJECT_DETECTION_SWAP_RB](https://docs.imgproxy.net/latest/configuration/options#IMGPROXY_OBJECT_DETECTION_SWAP_RB) config.
|
- (pro) Add [IMGPROXY_OBJECT_DETECTION_SWAP_RB](https://docs.imgproxy.net/latest/configuration/options#IMGPROXY_OBJECT_DETECTION_SWAP_RB) config.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Rename `IMGPROXY_ENABLE_WEBP_DETECTION` to `IMGPROXY_AUTO_WEBP`. The old name is deprecated but still supported.
|
||||||
|
- Rename `IMGPROXY_ENABLE_AVIF_DETECTION` to `IMGPROXY_AUTO_AVIF`. The old name is deprecated but still supported.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fix detecting of width and height of HEIF images that include `irot` boxes.
|
- Fix detecting of width and height of HEIF images that include `irot` boxes.
|
||||||
- Set `Error` status for errorred traces in OpenTelemetry.
|
- Set `Error` status for errorred traces in OpenTelemetry.
|
||||||
@@ -16,6 +20,10 @@
|
|||||||
- (pro) Fix detecting of width and height when orientation is specified in EXIF but EXIF info is not requested.
|
- (pro) Fix detecting of width and height when orientation is specified in EXIF but EXIF info is not requested.
|
||||||
- (pro) Fix watermark shadow clipping.
|
- (pro) Fix watermark shadow clipping.
|
||||||
|
|
||||||
|
### Deprecated
|
||||||
|
- `IMGPROXY_ENABLE_WEBP_DETECTION` config is deprecated. Use `IMGPROXY_AUTO_WEBP` instead.
|
||||||
|
- `IMGPROXY_ENABLE_AVIF_DETECTION` config is deprecated. Use `IMGPROXY_AUTO_AVIF` instead.
|
||||||
|
|
||||||
## [3.26.1] - 2024-10-28
|
## [3.26.1] - 2024-10-28
|
||||||
### Changed
|
### Changed
|
||||||
- (pro) Improve `monochrome` and `duotone` processing options.
|
- (pro) Improve `monochrome` and `duotone` processing options.
|
||||||
|
@@ -65,11 +65,11 @@ var (
|
|||||||
ReturnAttachment bool
|
ReturnAttachment bool
|
||||||
SvgFixUnsupported bool
|
SvgFixUnsupported bool
|
||||||
|
|
||||||
EnableWebpDetection bool
|
AutoWebp bool
|
||||||
EnforceWebp bool
|
EnforceWebp bool
|
||||||
EnableAvifDetection bool
|
AutoAvif bool
|
||||||
EnforceAvif bool
|
EnforceAvif bool
|
||||||
EnableJxlDetection bool
|
AutoJxl bool
|
||||||
EnforceJxl bool
|
EnforceJxl bool
|
||||||
EnableClientHints bool
|
EnableClientHints bool
|
||||||
|
|
||||||
@@ -267,11 +267,11 @@ func Reset() {
|
|||||||
ReturnAttachment = false
|
ReturnAttachment = false
|
||||||
SvgFixUnsupported = false
|
SvgFixUnsupported = false
|
||||||
|
|
||||||
EnableWebpDetection = false
|
AutoWebp = false
|
||||||
EnforceWebp = false
|
EnforceWebp = false
|
||||||
EnableAvifDetection = false
|
AutoAvif = false
|
||||||
EnforceAvif = false
|
EnforceAvif = false
|
||||||
EnableJxlDetection = false
|
AutoJxl = false
|
||||||
EnforceJxl = false
|
EnforceJxl = false
|
||||||
EnableClientHints = false
|
EnableClientHints = false
|
||||||
|
|
||||||
@@ -494,11 +494,20 @@ func Configure() error {
|
|||||||
configurators.Bool(&ReturnAttachment, "IMGPROXY_RETURN_ATTACHMENT")
|
configurators.Bool(&ReturnAttachment, "IMGPROXY_RETURN_ATTACHMENT")
|
||||||
configurators.Bool(&SvgFixUnsupported, "IMGPROXY_SVG_FIX_UNSUPPORTED")
|
configurators.Bool(&SvgFixUnsupported, "IMGPROXY_SVG_FIX_UNSUPPORTED")
|
||||||
|
|
||||||
configurators.Bool(&EnableWebpDetection, "IMGPROXY_ENABLE_WEBP_DETECTION")
|
if _, ok := os.LookupEnv("IMGPROXY_ENABLE_WEBP_DETECTION"); ok {
|
||||||
|
log.Warning("IMGPROXY_ENABLE_WEBP_DETECTION is deprecated, use IMGPROXY_AUTO_WEBP instead")
|
||||||
|
configurators.Bool(&AutoWebp, "IMGPROXY_ENABLE_WEBP_DETECTION")
|
||||||
|
}
|
||||||
|
if _, ok := os.LookupEnv("IMGPROXY_ENABLE_AVIF_DETECTION"); ok {
|
||||||
|
log.Warning("IMGPROXY_ENABLE_AVIF_DETECTION is deprecated, use IMGPROXY_AUTO_AVIF instead")
|
||||||
|
configurators.Bool(&AutoAvif, "IMGPROXY_ENABLE_AVIF_DETECTION")
|
||||||
|
}
|
||||||
|
|
||||||
|
configurators.Bool(&AutoWebp, "IMGPROXY_AUTO_WEBP")
|
||||||
configurators.Bool(&EnforceWebp, "IMGPROXY_ENFORCE_WEBP")
|
configurators.Bool(&EnforceWebp, "IMGPROXY_ENFORCE_WEBP")
|
||||||
configurators.Bool(&EnableAvifDetection, "IMGPROXY_ENABLE_AVIF_DETECTION")
|
configurators.Bool(&AutoAvif, "IMGPROXY_AUTO_AVIF")
|
||||||
configurators.Bool(&EnforceAvif, "IMGPROXY_ENFORCE_AVIF")
|
configurators.Bool(&EnforceAvif, "IMGPROXY_ENFORCE_AVIF")
|
||||||
configurators.Bool(&EnableJxlDetection, "IMGPROXY_ENABLE_JXL_DETECTION")
|
configurators.Bool(&AutoJxl, "IMGPROXY_AUTO_JXL")
|
||||||
configurators.Bool(&EnforceJxl, "IMGPROXY_ENFORCE_JXL")
|
configurators.Bool(&EnforceJxl, "IMGPROXY_ENFORCE_JXL")
|
||||||
configurators.Bool(&EnableClientHints, "IMGPROXY_ENABLE_CLIENT_HINTS")
|
configurators.Bool(&EnableClientHints, "IMGPROXY_ENABLE_CLIENT_HINTS")
|
||||||
|
|
||||||
|
@@ -1081,17 +1081,17 @@ func defaultProcessingOptions(headers http.Header) (*ProcessingOptions, error) {
|
|||||||
headerAccept := headers.Get("Accept")
|
headerAccept := headers.Get("Accept")
|
||||||
|
|
||||||
if strings.Contains(headerAccept, "image/webp") {
|
if strings.Contains(headerAccept, "image/webp") {
|
||||||
po.PreferWebP = config.EnableWebpDetection || config.EnforceWebp
|
po.PreferWebP = config.AutoWebp || config.EnforceWebp
|
||||||
po.EnforceWebP = config.EnforceWebp
|
po.EnforceWebP = config.EnforceWebp
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.Contains(headerAccept, "image/avif") {
|
if strings.Contains(headerAccept, "image/avif") {
|
||||||
po.PreferAvif = config.EnableAvifDetection || config.EnforceAvif
|
po.PreferAvif = config.AutoAvif || config.EnforceAvif
|
||||||
po.EnforceAvif = config.EnforceAvif
|
po.EnforceAvif = config.EnforceAvif
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.Contains(headerAccept, "image/jxl") {
|
if strings.Contains(headerAccept, "image/jxl") {
|
||||||
po.PreferJxl = config.EnableJxlDetection || config.EnforceJxl
|
po.PreferJxl = config.AutoJxl || config.EnforceJxl
|
||||||
po.EnforceJxl = config.EnforceJxl
|
po.EnforceJxl = config.EnforceJxl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -478,7 +478,7 @@ func (s *ProcessingOptionsTestSuite) TestParsePathStripMetadata() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *ProcessingOptionsTestSuite) TestParsePathWebpDetection() {
|
func (s *ProcessingOptionsTestSuite) TestParsePathWebpDetection() {
|
||||||
config.EnableWebpDetection = true
|
config.AutoWebp = true
|
||||||
|
|
||||||
path := "/plain/http://images.dev/lorem/ipsum.jpg"
|
path := "/plain/http://images.dev/lorem/ipsum.jpg"
|
||||||
headers := http.Header{"Accept": []string{"image/webp"}}
|
headers := http.Header{"Accept": []string{"image/webp"}}
|
||||||
|
@@ -46,7 +46,7 @@ func initProcessingHandler() {
|
|||||||
|
|
||||||
vary := make([]string, 0)
|
vary := make([]string, 0)
|
||||||
|
|
||||||
if config.EnableWebpDetection || config.EnforceWebp || config.EnableAvifDetection || config.EnforceAvif {
|
if config.AutoWebp || config.EnforceWebp || config.AutoAvif || config.EnforceAvif {
|
||||||
vary = append(vary, "Accept")
|
vary = append(vary, "Accept")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user