mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-08-29 12:23:21 +08:00
chore(Uploader): identify bmp and jfif format (#3040)
This commit is contained in:
parent
74ea6cbafc
commit
918abd8dd4
@ -8,10 +8,10 @@ interface File {
|
|||||||
image: boolean; // 是否为图片
|
image: boolean; // 是否为图片
|
||||||
}
|
}
|
||||||
|
|
||||||
const IMAGE_EXT = ['jpeg', 'jpg', 'gif', 'png', 'svg', 'webp'];
|
const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
|
||||||
|
|
||||||
export function isImageUrl(url: string): boolean {
|
function isImageUrl(url: string): boolean {
|
||||||
return IMAGE_EXT.some(ext => url.indexOf(`.${ext}`) !== -1 || url.indexOf(`.${ext.toLocaleUpperCase()}`) !== -1); // 有些七牛返回来的后缀的大写,加以判断
|
return IMAGE_REGEXP.test(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isImageFile(item: File): boolean {
|
export function isImageFile(item: File): boolean {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user