alle new
This commit is contained in:
erik committed 2026-10-01 06:46:51 +02:00
1 parent da64472251
commit 5b20adee48
1605 files changed
+396517 -1674

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
var _ = require("underscore");
var promises = require("./promises");
var Html = require("./html");
exports.imgElement = imgElement;
function imgElement(func) {
return function(element, messages) {
return promises.resolve(func(element)).then(function(result) {
var attributes = {};
if (element.altText) {
attributes.alt = element.altText;
}
_.extend(attributes, result);
return [Html.freshElement("img", attributes)];
});
};
}
// Undocumented, but retained for backwards-compatibility with 0.3.x
exports.inline = exports.imgElement;
exports.dataUri = imgElement(function(element) {
return element.readAsBase64String().then(function(imageBuffer) {
return {
src: "data:" + element.contentType + ";base64," + imageBuffer
};
});
});
function imageFilenameExtension(image) {
return image.contentType.split(/\/|\\/)[1];
}
exports.imageFilenameExtension = imageFilenameExtension;