diff options
-rw-r--r-- | src/view/com/modals/crop-image/cropImageUtil.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/view/com/modals/crop-image/cropImageUtil.ts b/src/view/com/modals/crop-image/cropImageUtil.ts new file mode 100644 index 000000000..303d15ba5 --- /dev/null +++ b/src/view/com/modals/crop-image/cropImageUtil.ts @@ -0,0 +1,13 @@ +export const calculateDimensions = ( + maxWidth: number, + originalHeight: number, + originalWidth: number, +) => { + const aspectRatio = originalWidth / originalHeight + const newHeight = maxWidth / aspectRatio + const newWidth = maxWidth + return { + width: newWidth, + height: newHeight, + } +} |