mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
working images in the database
This commit is contained in:
1 parent
997f550aab
commit
9e40fb8010
15 files changed
+157
-128
No files matched your search
@@ -0,0 +1,16 @@
|
||||
// this is a hack. We are saving images in the database as
|
||||
// delimiter separated URLS, but most common delimiters (comma, pipe
|
||||
// hash, etc.) are often found in URLS (even though it's not technically
|
||||
// within specification). To get around this we have our own delimiter
|
||||
// here we'll use to join and split these strings
|
||||
export const IMAGE_DELIMITER = "||!||";
|
||||
|
||||
export function withValidImage(link, onSuccess) {
|
||||
// only add the media if it's a valid URL
|
||||
const image = new Image();
|
||||
image.onload = onSuccess;
|
||||
image.onerror = () => {
|
||||
console.warn(`Invalid image submitted: ${link}`);
|
||||
};
|
||||
image.src = link;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
export function withValidMedia(link, onSuccess) {
|
||||
// only add the media if it's a valid URL
|
||||
const image = new Image();
|
||||
image.onload = onSuccess;
|
||||
image.onerror = () => {
|
||||
console.warn(`Invalid image submitted: ${link}`);
|
||||
};
|
||||
image.src = link;
|
||||
}
|
||||
Reference in new issue
Block a user