使うとおもって実装したけど、仕様書みたらいらなかったので供養します。
画像のw/h取得くん
画像のサイズ(width/height)を取得するやつ。
interface Result {
width: number;
height: number;
}
export const getImageSize = (file: File): Promise<Result> => {
return new Promise((resolve) => {
const image = new Image();
image.onload = function () {
resolve({ width: image.naturalWidth, height: image.naturalHeight });
};
image.src = URL.createObjectURL(file);
});
};