-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathtest.html
58 lines (54 loc) · 1.79 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
47
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html>
<head>
<title>
Exemple de HTML
</title>
</head>
<link rel="stylesheet" type="text/css" href="vendor/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/annotate.css">
<body>
<div class="my-image-selector">
<button class="push-new-image">Push a new image!</button>
<button class="export-image">Export image</button>
</div>
<div style="margin-top:50px">
<div id="myCanvas" style="position:relative"></div>
</div>
<script type="text/javascript" src="vendor/js/jquery.min.js"></script>
<script type="text/javascript" src="vendor/js/bootstrap.min.js"></script>
<script type="text/javascript" src="djaodjin-annotate.js"></script>
<script>
$(document).ready(function(){
var counter = 0;
$('#myCanvas').on("annotate-image-added", function(event, id, path){
$(".my-image-selector").append("<label><input type=\"radio\" name=\"image-selector\" class=\"annotate-image-select\" value=\"" + path + "\" checked id=\"" + id + "\"><img src=\"" + path + "\" width=\"35\" height=\"35\"></label>");
});
$('#myCanvas').annotate({
color: 'blue',
bootstrap: true,
images: ['images/test.jpg'],
onExport: function(image){
if ($("#exported-image").length > 0){
$("#exported-image").remove();
}
$("body").append("<img src=\"" + image + "\" id=\"exported-image\">");
}
});
$(".push-new-image").click(function(event) {
if (counter === 0){
$('#myCanvas').annotate("push", "images/test_2.jpg");
counter += 1;
}else{
$('#myCanvas').annotate("push", {id:"unique_identifier", path:"images/test.jpg"});
}
});
$(".export-image").click(function(event) {
$('#myCanvas').annotate("export", {type: "image/jpeg", quality: 0.2},function(d){
console.log(d);
});
});
});
</script>
</body>
</html>