mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-28 20:39:59 +00:00
Added support for svg in comics (not working in IE11)
This commit is contained in:
parent
8bfd3c7e4f
commit
691a4a88e6
@ -96,6 +96,11 @@ var createURLFromArray = function(array, mimeType) {
|
|||||||
var url;
|
var url;
|
||||||
var blob;
|
var blob;
|
||||||
|
|
||||||
|
if (mimeType === 'image/xml+svg') {
|
||||||
|
const xmlStr = new TextDecoder('utf-8').decode(array);
|
||||||
|
return 'data:image/svg+xml;UTF-8,' + encodeURIComponent(xmlStr);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Move all this browser support testing to a common place
|
// TODO: Move all this browser support testing to a common place
|
||||||
// and do it just once.
|
// and do it just once.
|
||||||
|
|
||||||
@ -130,7 +135,7 @@ kthoom.ImageFile = function(file) {
|
|||||||
var fileExtension = file.filename.split(".").pop().toLowerCase();
|
var fileExtension = file.filename.split(".").pop().toLowerCase();
|
||||||
var mimeType = fileExtension === "png" ? "image/png" :
|
var mimeType = fileExtension === "png" ? "image/png" :
|
||||||
(fileExtension === "jpg" || fileExtension === "jpeg") ? "image/jpeg" :
|
(fileExtension === "jpg" || fileExtension === "jpeg") ? "image/jpeg" :
|
||||||
fileExtension === "gif" ? "image/gif" : null;
|
fileExtension === "gif" ? "image/gif" : fileExtension == 'svg' ? 'image/xml+svg' : undefined;
|
||||||
this.dataURI = createURLFromArray(file.fileData, mimeType);
|
this.dataURI = createURLFromArray(file.fileData, mimeType);
|
||||||
this.data = file;
|
this.data = file;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user