handle base64 & binary images

This commit is contained in:
Alex Adam 2020-06-16 18:19:04 +03:00
parent 21ccfcf766
commit 3f162d75dc
2 changed files with 9 additions and 7 deletions

View file

@ -379,9 +379,10 @@ function deferredAddZip(url, filename) {
extractedImages.push({
filename: filename,
isBinary: true,
data: data
// TODO - must be JSON serializable
data: base64ArrayBuffer(data)
});
deferred.resolve();
}
});

View file

@ -174,11 +174,12 @@ function _buildEbook(allPages, fromMenu=false) {
allPages.forEach(function(page) {
for (let i = 0; i < page.images.length; i++) {
let tmpImg = page.images[i]
if (tmpImg.isBinary) {
imgsFolder.file(tmpImg.filename, tmpImg.data, {binary: true})
} else {
// TODO - Must be JSON serializable - see the same comment in extractHtml.js
// if (tmpImg.isBinary) {
// imgsFolder.file(tmpImg.filename, tmpImg.data, {binary: true})
// } else {
imgsFolder.file(tmpImg.filename, tmpImg.data, {base64: true})
}
// }
}
});
} catch (error) {