Convert data URL to plain base64-encoded image data

This commit is contained in:
ceruleandeep 2024-11-18 18:30:31 +11:00
parent 5992117904
commit 8927de45dd
1 changed files with 4 additions and 2 deletions

View File

@ -3283,7 +3283,8 @@ async function generateComfyImage(prompt, negativePrompt, signal) {
const response = await fetch(getUserAvatarUrl());
if (response.ok) {
const avatarBlob = await response.blob();
const avatarBase64 = await getBase64Async(avatarBlob);
const avatarBase64DataUrl = await getBase64Async(avatarBlob);
const avatarBase64 = avatarBase64DataUrl.split(',')[1];
workflow = workflow.replaceAll('"%user_avatar%"', JSON.stringify(avatarBase64));
} else {
workflow = workflow.replaceAll('"%user_avatar%"', JSON.stringify(PNG_PIXEL));
@ -3293,7 +3294,8 @@ async function generateComfyImage(prompt, negativePrompt, signal) {
const response = await fetch(getCharacterAvatarUrl());
if (response.ok) {
const avatarBlob = await response.blob();
const avatarBase64 = await getBase64Async(avatarBlob);
const avatarBase64DataUrl = await getBase64Async(avatarBlob);
const avatarBase64 = avatarBase64DataUrl.split(',')[1];
workflow = workflow.replaceAll('"%char_avatar%"', JSON.stringify(avatarBase64));
} else {
workflow = workflow.replaceAll('"%char_avatar%"', JSON.stringify(PNG_PIXEL));