import { RcFile } from 'antd/es/upload';

export async function getImageSize(file: RcFile): Promise<{ width: number; height: number }> {
  return new Promise((resolve, reject) => {
    const img = new Image();

    img.onload = () => {
      resolve({ width: img.width, height: img.height });
    };

    img.onerror = (err) => {
      reject(err);
    };

    img.src = URL.createObjectURL(file);
  });
}
