import larger images

This commit is contained in:
Skyler Lehmkuhl 2024-12-05 17:03:52 -05:00
parent ae5e526b2e
commit 7f34e0e542
1 changed files with 10 additions and 1 deletions

View File

@ -3117,6 +3117,15 @@ const panes = {
},
}
function _arrayBufferToBase64( buffer ) {
var binary = '';
var bytes = new Uint8Array( buffer );
var len = bytes.byteLength;
for (var i = 0; i < len; i++) {
binary += String.fromCharCode( bytes[ i ] );
}
return window.btoa( binary );
}
async function convertToDataURL(filePath) {
try {
@ -3127,7 +3136,7 @@ async function convertToDataURL(filePath) {
throw new Error('Unsupported image type');
}
const base64Data = btoa(String.fromCharCode(...binaryData))
const base64Data = _arrayBufferToBase64(binaryData)
const dataURL = `data:${mimeType};base64,${base64Data}`;
return dataURL;