forked from shraddhavijay/IFAKE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimage.html
154 lines (143 loc) · 7.31 KB
/
image.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
{% load static %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<title>Ifake</title>
<link rel="stylesheet" href="{% static 'assets/bootstrap/css/bootstrap.min.css' %}">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Aldrich">
<link rel="stylesheet" href="{% static 'assets/fonts/ionicons.min.css' %}">
<link rel="stylesheet" href="{% static 'assets/css/Footer-Dark.css' %}">
<link rel="stylesheet" href="{% static 'assets/css/Navigation-with-Search.css' %}">
<link rel="stylesheet" href="{% static 'assets/css/style.css' %}">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/magnify/2.3.3/css/magnify.css" integrity="sha512-JxBFHHd+xyHl++SdVJYCCgxGPJKCTTaqndOl/n12qI73hgj7PuGuYDUcCgtdSHTeXSHCtW4us4Qmv+xwPqKVjQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
<body style="background: linear-gradient(0deg,#ff6a00,#ee0979);height: 947px;">
<nav class="navbar navbar-light navbar-expand-md navigation-clean-search" style="background-color: #343a40;">
<div class="container"><a class="navbar-brand" href="{% url 'index' %}" style="color: rgb(255,255,255);">IFAKE</a>
<button class="navbar-toggler" data-toggle="collapse"><span class="sr-only">Toggle navigation</span><span
class="navbar-toggler-icon"></span></button>
</div>
</nav>
<div>
<div class="container">
<div class="row">
<div class="col-md-6">
<form method="POST" action="runAnalysis" enctype="multipart/form-data">
{% csrf_token %}
<div class="form-row">
<div class="col"><input type="file" id="input_image" name="input_image"
onchange="loadFile(event)"
style="height: 38px;padding: 11px;margin: 10px;"></div>
</div>
<img id="upl_img" src='{{ input_image }}' class="zoom" data-magnify-src='{{ input_image }}'
onerror=this.src="https://media.istockphoto.com/vectors/fake-grunge-false-red-stamp-vector-id907865828"
style="background-color: #222222;width: 500px;height: 500px; ">
<button class="btn btn-primary" type="submit" name="run" value="run" style="margin: 15px;">Check
</button>
<div class="alert alert-success" role="alert"><span>Result: Image is <b>{{ result.type }}</b><br>
Confidence: <b>{{ result.confidence }}%</b><br>
<p style="font-weight: normal; font-size: 15px;" id="identicalreg"></p>
</span></div>
<h4>Metadata</h4>
<table class="table table-bordered table-striped table-dark table-hover" >
<tr>
<th>Attribute</th>
<th>Value</th>
</tr>
{% for key, value in metadata %}
<tr>
<td>{{key}}</td>
<td>{{value}}</td>
</tr>
{% endfor %}
</table>
</form>
</div>
<div class="col-md-6" id="imagegenerationSecton">
<form method="POST" action="getImages" enctype="multipart/form-data">
{% csrf_token %}
<div class="form-row">
<div class="col">
<div class="btn-group" role="group" style="margin: 10px;">
<button id="maskButton" class="btn btn-primary" type="submit" name="mask" value="mask"
style="margin-right: 5px;background: black;">Mask
</button>
<button class="btn btn-primary" type="submit" name="ela" value="ela"
style="margin-right: 5px;background: black;">ELA
</button>
<button class="btn btn-primary" type="submit" name="edge_map" value="edge_map"
style="margin-right: 5px;background: black;">Edge Map
</button>
<button class="btn btn-primary" type="submit" name="na" value="na"
style="background: black;">Noise Analysis
</button>
<button class="btn btn-primary" type="submit" name="copy_move_sift" value="copy_move_sift"
style="background: black;">Copy Move
</button>
</div>
</div>
</div>
<img id="output_img" alt='Output' src="{{ url }}" class="zoom2" data-magnify-src='{{ url }}'
onerror=this.src="https://media.istockphoto.com/vectors/fake-grunge-false-red-stamp-vector-id907865828"
style="background-color: #222222;width: 500px;height: 500px; ">
</form>
</div>
</div>
</div>
</div>
<footer class="py-5 bg-black">
<div class="container">
<p class="text-center text-white m-0 small">Copyright © IFAKE 2021</p>
</div>
</footer>
<script src="{% static 'assets/js/jquery.min.js' %}"></script>
<script src="{% static 'assets/bootstrap/js/bootstrap.min.js' %}"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/magnify/2.3.3/js/jquery.magnify.min.js" integrity="sha512-YKxHqn7D0M5knQJO2xKHZpCfZ+/Ta7qpEHgADN+AkY2U2Y4JJtlCEHzKWV5ZE87vZR3ipdzNJ4U/sfjIaoHMfw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script>
$(document).ready(function() {
$('.zoom').magnify();
});
</script>
<script>
$(document).ready(function() {
$('.zoom2').magnify();
});
</script>
<script>
var loadFile = function (event) {
var input_image = document.getElementById('upl_img');
input_image.src = URL.createObjectURL(event.target.files[0]);
};
var img_res = "{{result.type}}";
//var identical_regions = "{{result.identical_regions}}";
//var noise_var = "{{result.noise_var}}";
//var dataNode = document.getElementById('identicalreg');
var imagesSection = document.getElementById('imagegenerationSecton');
var maskButton= document.getElementById('maskButton');
if (img_res){
imagesSection.style.display = "block";
if(img_res=="Forged"){
maskButton.style.display = "block";
}
else{
maskButton.style.display = "none";
}
}
else{
imagesSection.style.display = "none";
}
/*
let result = img_res.localeCompare("Forged");
if (result == 0) {
dataNode.innerHTML = "Details: {{result.compression}}";
if (noise_var == 1)
dataNode.innerHTML = dataNode.innerHTML + ", Noise variance inconsistency detected";
if (identical_regions > 0)
dataNode.innerHTML = dataNode.innerHTML + "\nNo. of identical regions: {{result.identical_regions}}";
}
*/
</script>
</body>
</html>