소스 검색

Don't extend if requested width or height is zero

DarthSim 2 년 전
부모
커밋
0863734ff8
2개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  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
 	}