Skip to content

Instantly share code, notes, and snippets.

@GordonSmith
Last active December 10, 2017 08:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GordonSmith/027841e31e7186069d796eba4c31b691 to your computer and use it in GitHub Desktop.
Save GordonSmith/027841e31e7186069d796eba4c31b691 to your computer and use it in GitHub Desktop.
hpcc-js + WU hosted Image
<!DOCTYPE html>
<html>
<head>
<title>HPCC WU Hosted Image</title>
<meta charset="utf-8" />
<style>
body {
padding: 0px;
margin: 0px;
overflow: hidden;
}
</style>
<script src="https://unpkg.com/@hpcc-js/util@0.0.50"></script>
<script src="https://unpkg.com/@hpcc-js/comms@0.0.56/build/index.js"></script>
<script>
var hpccComms = window["@hpcc-js/comms"];
</script>
</head>
<body>
<img id="placeholder"></img>
<script>
var wu = hpccComms.Workunit.attach({ baseUrl: "http://52.51.90.23:8010" }, "W20171210-075100");
wu.fetchResults().then(function (results) {
return results[0].fetchRows(0, 1);
}).then(function (rows) {
document.getElementById("placeholder").setAttribute("src", "data:image/png;base64," + rows[0].base64image);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment