MCPcopy
hub / github.com/microsoft/SandDance / formatImage

Function formatImage

docs/tests/v2/es6/js/sanddance.js:846–858  ·  view source on GitHub ↗
(image, message, scale)

Source from the content-addressed store, hash-verified

844}
845
846function formatImage(image, message, scale) {
847 var maxWidth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 600;
848 var imageUrl = image.src.replace(/\(/g, '%28').replace(/\)/g, '%29');
849
850 if (image.width > maxWidth) {
851 scale = Math.min(scale, maxWidth / image.width);
852 }
853
854 var width = image.width * scale;
855 var height = image.height * scale;
856 var style = ['font-size:1px;', "padding:".concat(Math.floor(height / 2), "px ").concat(Math.floor(width / 2), "px;"), "line-height:".concat(height, "px;"), "background:url(".concat(imageUrl, ");"), "background-size:".concat(width, "px ").concat(height, "px;"), 'color:transparent;'].join('');
857 return ["".concat(message, " %c+"), style];
858}
859},{}],"lXkG":[function(require,module,exports) {
860"use strict";
861

Callers

nothing calls this directly

Calls 2

replaceMethod · 0.80
minMethod · 0.45

Tested by

no test coverage detected