diff options
| -rw-r--r-- | lib/document-to-html.js | 2 | ||||
| -rw-r--r-- | tests/document-to-html.tests.js | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/document-to-html.js b/lib/document-to-html.js index e02ca6f..25892d5 100644 --- a/lib/document-to-html.js +++ b/lib/document-to-html.js @@ -104,7 +104,7 @@ function DocumentConverter(options) { }, "image": function(element, html, messages, callback) { element.read("base64").then(function(imageBuffer) { - var src = "data:image/png;base64," + imageBuffer; + var src = "data:" + element.contentType + ";base64," + imageBuffer; var attributes = {src: src}; if (element.altText) { attributes.alt = element.altText; diff --git a/tests/document-to-html.tests.js b/tests/document-to-html.tests.js index 864e3ee..c7b7bcf 100644 --- a/tests/document-to-html.tests.js +++ b/tests/document-to-html.tests.js @@ -179,7 +179,8 @@ describe('DocumentConverter', function() { var image = new documents.Image({ readImage: function(encoding) { return q.when(imageBuffer.toString(encoding)); - } + }, + contentType: "image/png" }); var converter = new DocumentConverter(); return converter.convertToHtml(image).then(function(result) { |
