MCPcopy Create free account
hub / github.com/microsoft/SandDance / formatImage

Function formatImage

docs/app/js/sanddance-app.js:58495–58513  ·  view source on GitHub ↗
(image, message, scale)

Source from the content-addressed store, hash-verified

58493 return "".concat(string).concat(terminator);
58494}
58495function formatImage(image, message, scale) {
58496 let maxWidth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 600;
58497 const imageUrl = image.src.replace(/\(/g, "%28").replace(/\)/g, "%29");
58498 if (image.width > maxWidth) scale = Math.min(scale, maxWidth / image.width);
58499 const width = image.width * scale;
58500 const height = image.height * scale;
58501 const style = [
58502 "font-size:1px;",
58503 "padding:".concat(Math.floor(height / 2), "px ").concat(Math.floor(width / 2), "px;"),
58504 "line-height:".concat(height, "px;"),
58505 "background:url(".concat(imageUrl, ");"),
58506 "background-size:".concat(width, "px ").concat(height, "px;"),
58507 "color:transparent;"
58508 ].join("");
58509 return [
58510 "".concat(message, " %c+"),
58511 style
58512 ];
58513}
58514
58515},{"@parcel/transformer-js/src/esmodule-helpers.js":"jA2du"}],"3xLbR":[function(require,module,exports) {
58516var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");

Callers

nothing calls this directly

Calls 2

replaceMethod · 0.80
minMethod · 0.45

Tested by

no test coverage detected