-
Notifications
You must be signed in to change notification settings - Fork 62
/
test.html
46 lines (44 loc) · 1.45 KB
/
test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<html lang="en">
<head>
<title>photosphere</title>
<style>
.right{ float: right; }
</style>
</head>
<body>
<a href="stest.jpg" id="goForIt">makeIt</a>
<div class="right">
load from file:
<input type="file" id="loaditup" />
</div>
<div id="sphere" style="width: 100%; height: 600px;"></div>
<a href="https://github.com/kennydude/">fork me on github</a>
<script type="text/javascript" src="http://threejs.org/build/three.min.js"></script>
<script async="true" onload="setup();" type="text/javascript" src="lib/sphere.js"></script>
<script type="text/javascript">
function setup(){
document.getElementById("goForIt").onclick = function(){
sphere = new Photosphere(this.getAttribute("href"));
sphere.loadPhotosphere(document.getElementById("sphere"));
return false;
};
document.getElementById("loaditup").addEventListener("change", function(evt){
var files = evt.target.files; // FileList object
// files is a FileList of File objects. List some properties.
var output = [];
for (var i = 0, f; f = files[i]; i++) {
var blob = URL.createObjectURL(f);
var reader = new FileReader();
reader.onloadend = function(evt){
sphere = new Photosphere( blob );
sphere.binary_data = evt.target.result;
sphere.loadPhotosphere(document.getElementById("sphere"));
}
reader.readAsBinaryString(f);
}
});
}
</script>
</body>
</html>