-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Expand file tree
/
Copy pathimage.ts
More file actions
15 lines (14 loc) · 637 Bytes
/
image.ts
File metadata and controls
15 lines (14 loc) · 637 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
export const getCompressURL = (url: string) => {
if (url.startsWith("assets/") &&
(url.endsWith(".png") || url.endsWith(".jpg") || url.endsWith(".jpeg") || url.endsWith(".heic") || url.endsWith(".heif"))) {
return url + "?style=thumb";
}
return url;
};
export const removeCompressURL = (url: string) => {
if (url.startsWith("assets/") &&
(url.endsWith(".png?style=thumb") || url.endsWith(".jpg?style=thumb") || url.endsWith(".jpeg?style=thumb") || url.endsWith(".heic?style=thumb") || url.endsWith(".heif?style=thumb"))) {
return url.replace("?style=thumb", "");
}
return url;
};