mirror of
https://github.com/alexadam/save-as-ebook.git
synced 2025-09-10 09:24:49 +00:00
handle base64 & binary images
This commit is contained in:
parent
21ccfcf766
commit
3f162d75dc
2 changed files with 9 additions and 7 deletions
|
@ -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();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue