import larger images
This commit is contained in:
parent
ae5e526b2e
commit
7f34e0e542
11
src/main.js
11
src/main.js
|
|
@ -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) {
|
async function convertToDataURL(filePath) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -3127,7 +3136,7 @@ async function convertToDataURL(filePath) {
|
||||||
throw new Error('Unsupported image type');
|
throw new Error('Unsupported image type');
|
||||||
}
|
}
|
||||||
|
|
||||||
const base64Data = btoa(String.fromCharCode(...binaryData))
|
const base64Data = _arrayBufferToBase64(binaryData)
|
||||||
const dataURL = `data:${mimeType};base64,${base64Data}`;
|
const dataURL = `data:${mimeType};base64,${base64Data}`;
|
||||||
|
|
||||||
return dataURL;
|
return dataURL;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue