{
"BinaryFile" : [
{
"E_DATA" : "/9j/4AAQSk...jr1dYuv/9k=",
"E_MIMETYPE" : "image/jpeg",
"E_FILENAME" : "SAPUI5.jpg"
}
]
}
<!doctype html>
<html>
<head>
<title>BinaryFileJPEG</title>
<meta http-equiv="Content-Type" content="text/html" />
<meta charset="ISO-8859-1" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<script src="resources/sap-ui-core.js" type="text/javascript"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.ui.commons, sap.ui.table"
data-sap-ui-theme="sap_bluecrystal">
</script>
<script type="text/javascript">
//-Begin----------------------------------------------------------------
//-Sub to execute when the DOM is fully loaded------------------------
$(function() {
//-Variables------------------------------------------------------
var oModel, Base64 = "", MimeTyp = "", FileName = "";
//-Load JSON file into model--------------------------------------
oModel = new sap.ui.model.json.JSONModel();
oModel.loadData("zBinaryFileJPEG.json", null, false);
sap.ui.getCore().setModel(oModel, "oModel");
//-Get the data for the image-------------------------------------
Base64 = oModel.getData().BinaryFile[0].E_DATA;
MimeTyp = oModel.getData().BinaryFile[0].E_MIMETYPE;
FileName = oModel.getData().BinaryFile[0].E_FILENAME;
//-Set the data of the image--------------------------------------
document.getElementById("image").setAttribute("data", "data:" +
MimeTyp + ";base64," + Base64);
//-Refresh content------------------------------------------------
document.getElementById("content").innerHTML =
document.getElementById("content").innerHTML;
});
//-End------------------------------------------------------------------
</script>
</head>
<body class="sapUiBody" role="application">
<div id="content">
<object id="image">
</object>
</div>
</body>
</html>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
5 | |
5 | |
5 | |
5 | |
4 | |
4 | |
4 | |
3 | |
3 |