Commit 691a4a88 authored by OzzieIsaacs's avatar OzzieIsaacs

Added support for svg in comics (not working in IE11)

parent 8bfd3c7e
......@@ -96,6 +96,11 @@ var createURLFromArray = function(array, mimeType) {
var url;
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
// and do it just once.
......@@ -130,7 +135,7 @@ kthoom.ImageFile = function(file) {
var fileExtension = file.filename.split(".").pop().toLowerCase();
var mimeType = fileExtension === "png" ? "image/png" :
(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.data = file;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment