1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2024-11-24 08:12:38 +02:00
imgproxy/security/image_size.go
2021-05-07 17:10:21 +06:00

17 lines
373 B
Go

package security
import (
"github.com/imgproxy/imgproxy/v2/config"
"github.com/imgproxy/imgproxy/v2/ierrors"
)
var ErrSourceResolutionTooBig = ierrors.New(422, "Source image resolution is too big", "Invalid source image")
func CheckDimensions(width, height int) error {
if width*height > config.MaxSrcResolution {
return ErrSourceResolutionTooBig
}
return nil
}