Quellcode durchsuchen

Don't extend if requested width or height is zero

DarthSim vor 2 Jahren
Ursprung
Commit
0863734ff8
2 geänderte Dateien mit 2 neuen und 1 gelöschten Zeilen
  1. 1 0
      CHANGELOG.md
  2. 1 1
      processing/extend.go

+ 1 - 0
CHANGELOG.md

@@ -3,6 +3,7 @@
 ## [Unreleased]
 ### Fix
 - Fix crashes in cases where the `max_bytes` processing option was used and image saving failed.
+- Fix error when using the `extend` or `extend_aspect_ratio` processing option while setting zero width or height.
 
 ## [3.16.0] - 2023-04-18
 ### Add

+ 1 - 1
processing/extend.go

@@ -8,7 +8,7 @@ import (
 )
 
 func extendImage(img *vips.Image, resultWidth, resultHeight int, opts *options.ExtendOptions, offsetScale float64, extendAr bool) error {
-	if !opts.Enabled || (resultWidth <= img.Width() && resultHeight <= img.Height()) {
+	if !opts.Enabled || (resultWidth <= img.Width() && resultHeight <= img.Height()) || resultWidth == 0 || resultHeight == 0 {
 		return nil
 	}