1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

feat: suppot remote image url

This commit is contained in:
songjunxi
2023-10-24 11:25:48 +08:00
parent 116e116332
commit 2b456637e9
8 changed files with 160 additions and 45 deletions

View File

@@ -24,3 +24,11 @@ export function getUrlFromString(str: string) {
return null;
}
}
export function isImageLink(link: string): boolean {
if (!isValidUrl(link)) return false;
const imageExtensions = [".jpg", ".jpeg", ".png", "webp", ".gif", ".bmp"];
const fileExtension = link.substring(link.lastIndexOf(".")).toLowerCase();
return imageExtensions.includes(fileExtension);
}