This repository has been archived on 2022-03-12. You can view files and clone it, but cannot push or open issues or pull requests.
2021-04-02 02:24:13 +03:00

20 lines
591 B
JavaScript

/* eslint-env browser */
import { getFilename } from './AssetUris';
export function isImageType(type) {
return /^(jpeg|jpg|gif|png|bmp|webp|heic)$/i.test(type);
}
export function getImageInfoAsync(url) {
return new Promise((resolve, reject) => {
const img = new Image();
img.onerror = reject;
img.onload = () => {
resolve({
name: getFilename(url),
width: img.naturalWidth,
height: img.naturalHeight,
});
};
img.src = url;
});
}
//# sourceMappingURL=ImageAssets.js.map