Files
imgproxy/security/image_size.go
Victor Sokolov d47eeee6ad IMG-44: move skip to processing, remove imath.Min/Max (#1485)
* Removed imath.Min/Max

* Skip goes to processing

* no svg_processing error category

* should report SVG
2025-08-15 12:38:16 +02:00

18 lines
463 B
Go

package security
func CheckDimensions(width, height, frames int, opts Options) error {
frames = max(frames, 1)
if frames > 1 && opts.MaxAnimationFrameResolution > 0 {
if width*height > opts.MaxAnimationFrameResolution {
return newImageResolutionError("Source image frame resolution is too big")
}
} else {
if width*height*frames > opts.MaxSrcResolution {
return newImageResolutionError("Source image resolution is too big")
}
}
return nil
}