You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
1.7 KiB
1 line
1.7 KiB
{"ast":null,"code":"import { getFilename } from \"./AssetUris\";\nexport function isImageType(type) {\n return /^(jpeg|jpg|gif|png|bmp|webp|heic)$/i.test(type);\n}\nexport function getImageInfoAsync(url) {\n return new Promise(function (resolve, reject) {\n var img = new Image();\n img.onerror = reject;\n img.onload = function () {\n resolve({\n name: getFilename(url),\n width: img.naturalWidth,\n height: img.naturalHeight\n });\n };\n img.src = url;\n });\n}","map":{"version":3,"sources":["../src/ImageAssets.ts"],"names":[],"mappings":"AACA,SAAS,WAAW;AAQpB,OAAM,SAAU,WAAW,CAAC,IAAY,EAAA;EACtC,OAAO,qCAAqC,CAAC,IAAI,CAAC,IAAI,CAAC;AACzD;AAEA,OAAM,SAAU,iBAAiB,CAAC,GAAW,EAAA;EAC3C,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM,EAAI;IACrC,IAAM,GAAG,GAAG,IAAI,KAAK,EAAE;IACvB,GAAG,CAAC,OAAO,GAAG,MAAM;IACpB,GAAG,CAAC,MAAM,GAAG,YAAK;MAChB,OAAO,CAAC;QACN,IAAI,EAAE,WAAW,CAAC,GAAG,CAAC;QACtB,KAAK,EAAE,GAAG,CAAC,YAAY;QACvB,MAAM,EAAE,GAAG,CAAC;OACb,CAAC;IACJ,CAAC;IACD,GAAG,CAAC,GAAG,GAAG,GAAG;EACf,CAAC,CAAC;AACJ","sourcesContent":["/* eslint-env browser */\nimport { getFilename } from './AssetUris';\n\ntype ImageInfo = {\n name: string;\n width: number;\n height: number;\n};\n\nexport function isImageType(type: string): boolean {\n return /^(jpeg|jpg|gif|png|bmp|webp|heic)$/i.test(type);\n}\n\nexport function getImageInfoAsync(url: string): Promise<ImageInfo> {\n return new Promise((resolve, reject) => {\n const img = new Image();\n img.onerror = reject;\n img.onload = () => {\n resolve({\n name: getFilename(url),\n width: img.naturalWidth,\n height: img.naturalHeight,\n });\n };\n img.src = url;\n });\n}\n"],"sourceRoot":""},"metadata":{},"sourceType":"module"} |