blob: 5ef9258e6154127e74c5ab640548519e023997e3 [file] [log] [blame]
Jeff Thompsone06b31e2012-09-30 17:19:19 -07001<?xml version = "1.0" encoding="utf-8" ?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3"DTD/xhtml1-strict.dtd">
4<html xmlns = "http://www.w3.org/1999/xhtml">
5
6<head>
7 <title>NDN Image Loader</title>
Jeff Thompson38422f42012-11-15 00:20:39 -08008
9 <script type="text/javascript" src="../Helper.js"></script>
Jeff Thompsone06b31e2012-09-30 17:19:19 -070010
11 <script type="text/javascript">
12 var loadedImageString = "";
13 var connector = new NDN();
14 var pieceNumber = 0;
15 var count = 0;
16 var end = false;
17 var LOG = 0;
18 var pieceSize = 1000;
19
20
21 function getPiece(){
22 if(!pieceNumber) pieceNumber = 0;
23 var contentName = "/image/piece" + pieceNumber;
24 var co = connector.get( contentName );
25
26 if(co){
27 loadedImageString += DataUtils.toString(co.content);
28 console.log("Received length: " + co.content.length);
29 if(co.content.length == pieceSize){
30 pieceNumber += co.content.length;
31 getPiece();
32 }
33 else document.getElementById('image').src += loadedImageString;
34 }
35 }
36
37
38
39
40
41 </script>
42
43</head>
44<body >
45 <div>
46 <button onclick="getPiece()">Get image</button>
47 </div>
48 <div >
49 <applet id="JavaSocketBridge" archive="../JavaSocketBridge.jar" code="JavaSocketBridge.class" width="0" height="0">
50 </applet>
51 </div>
52
53 <p id="result"></p>
54 <div>
55 <img id="image" src="data:image/png;base64," alt="Image placeholder" />
56 </div>
57
58</body>
59</html>