CheckDimensions checks if the given dimensions are within the allowed limits
(o *options.Options, width, height, frames int)
| 51 | |
| 52 | // CheckDimensions checks if the given dimensions are within the allowed limits |
| 53 | func (s *Checker) CheckDimensions(o *options.Options, width, height, frames int) error { |
| 54 | frames = max(frames, 1) |
| 55 | |
| 56 | maxFrameRes := s.MaxAnimationFrameResolution(o) |
| 57 | |
| 58 | if frames > 1 && maxFrameRes > 0 { |
| 59 | if width*height > maxFrameRes { |
| 60 | return newImageResolutionError("Source image frame resolution is too big") |
| 61 | } |
| 62 | return nil |
| 63 | } |
| 64 | |
| 65 | if width*height*frames > s.MaxSrcResolution(o) { |
| 66 | return newImageResolutionError("Source image resolution is too big") |
| 67 | } |
| 68 | |
| 69 | return nil |
| 70 | } |
no test coverage detected