diff --git a/src/typings.ts b/src/typings.ts index 785820c..89be36e 100644 --- a/src/typings.ts +++ b/src/typings.ts @@ -48,4 +48,9 @@ export type ErrorsType = { resolution?: boolean; } | null; -export type ResolutionType = 'absolute' | 'less' | 'more' | 'ratio'; +export type ResolutionType = + | 'absolute' + | 'less' + | 'more' + | 'ratio' + | 'ratioWithMinDimensions'; diff --git a/src/validation.ts b/src/validation.ts index 6bf30d7..caeb2b3 100644 --- a/src/validation.ts +++ b/src/validation.ts @@ -31,6 +31,16 @@ export const isResolutionValid = ( return true; break; } + case 'ratioWithMinDimensions': { + const ratio = resolutionWidth / resolutionHeight; + if ( + image.width / image.height === ratio && + image.width >= resolutionWidth && + image.height >= resolutionHeight + ) + return true; + break; + } default: break; }