image_size.go 373 B

12345678910111213141516
  1. package security
  2. import (
  3. "github.com/imgproxy/imgproxy/v3/config"
  4. "github.com/imgproxy/imgproxy/v3/ierrors"
  5. )
  6. var ErrSourceResolutionTooBig = ierrors.New(422, "Source image resolution is too big", "Invalid source image")
  7. func CheckDimensions(width, height int) error {
  8. if width*height > config.MaxSrcResolution {
  9. return ErrSourceResolutionTooBig
  10. }
  11. return nil
  12. }