Created
October 23, 2017 22:16
-
-
Save mhawksey/8d3e5dd8b05b6d70e5e099b09883e831 to your computer and use it in GitHub Desktop.
Apps Script exerpt to include images in HTML Service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* given an image object, it will generate an img tag | |
* @param {Object} imgData with image data | |
* @return {string} of img tag or src | |
*/ | |
ns.img = function (imgData, isImgTag) { | |
if (!isImgTag){ | |
var html = '<img '; | |
Object.entries(imgData).forEach(function(k){ html += k[0]+'="'+k[1]+'" '}); | |
html += '>\n' | |
return html | |
} else { | |
return imgData.src; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment