Say what a 0 side does in the ValidateDimension doc comment

It said 0 meant "original size"; the side is worked out from the
source's proportions, as README.md now says.

Model: opus-5-5
This commit is contained in:
2026-10-16 02:05:57 +00:00
parent 778d3b24bd
commit 0eaad0a3f9
+3 -1
View File
@@ -29,7 +29,9 @@ var (
const MaxDimension = imageprocessor.MaxOutputDimension const MaxDimension = imageprocessor.MaxOutputDimension
// ValidateDimension checks one requested width or height; name ("width" or // ValidateDimension checks one requested width or height; name ("width" or
// "height") appears in the error. 0 means "original size" and is valid. // "height") appears in the error. 0 is valid: that side is then worked out from
// the source's proportions and the other requested side, rounded down but at
// least 1, or is the source's own side when the other side is 0 too.
func ValidateDimension(name string, value int) error { func ValidateDimension(name string, value int) error {
if value < 0 { if value < 0 {
return fmt.Errorf("%w: %s is negative", ErrInvalidSize, name) return fmt.Errorf("%w: %s is negative", ErrInvalidSize, name)