-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMetaDataExtractor.html
More file actions
186 lines (159 loc) · 5.48 KB
/
MetaDataExtractor.html
File metadata and controls
186 lines (159 loc) · 5.48 KB
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ExifLens | Image Metadata</title>
<script src="https://cdn.jsdelivr.net/npm/exif-js"></script>
<style>
:root {
--primary: #6366f1;
--bg: #0f172a;
--card-bg: #1e293b;
--text-main: #f1f5f9;
--text-dim: #94a3b8;
}
body {
font-family: 'Inter', system-ui, -apple-system, sans-serif;
background-color: var(--bg);
color: var(--text-main);
margin: 0;
display: flex;
justify-content: center;
padding: 40px 20px;
}
.container {
width: 100%;
max-width: 900px;
}
header {
text-align: center;
margin-bottom: 40px;
}
h1 { font-size: 2.5rem; margin-bottom: 10px; letter-spacing: -1px; }
header p { color: var(--text-dim); }
/* The Upload Zone */
#drop-zone {
border: 2px dashed #334155;
background: var(--card-bg);
border-radius: 16px;
padding: 60px 20px;
text-align: center;
transition: all 0.3s ease;
cursor: pointer;
margin-bottom: 30px;
}
#drop-zone:hover, #drop-zone.hover {
border-color: var(--primary);
background: #243045;
}
.upload-icon {
font-size: 40px;
margin-bottom: 15px;
display: block;
}
/* Results Section */
.results-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
display: none; /* Hidden until upload */
}
@media (max-width: 768px) {
.results-grid { grid-template-columns: 1fr; }
}
.preview-card, .data-card {
background: var(--card-bg);
border-radius: 12px;
padding: 20px;
border: 1px solid #334155;
}
#preview {
width: 100%;
height: auto;
border-radius: 8px;
display: block;
}
.data-card h3 {
margin-top: 0;
font-size: 1.1rem;
border-bottom: 1px solid #334155;
padding-bottom: 10px;
color: var(--primary);
}
pre {
font-family: 'Fira Code', 'Courier New', monospace;
font-size: 13px;
color: #cbd5e1;
overflow-x: auto;
white-space: pre-wrap;
word-wrap: break-word;
}
.empty-state {
color: var(--text-dim);
text-align: center;
font-style: italic;
}
</style>
</head>
<body>
<div class="container">
<header>
<h1>ExifLens</h1>
<p>Reveal the hidden data behind your photos.</p>
</header>
<div id="drop-zone">
<span class="upload-icon">📸</span>
<strong>Click to upload</strong> or drag and drop<br>
<span style="font-size: 0.8em; color: var(--text-dim)">Supports JPG, JPEG, TIFF</span>
</div>
<input type="file" id="file-input" accept="image/jpeg" style="display:none">
<div class="results-grid" id="results-grid">
<div class="preview-card">
<img id="preview" alt="Image Preview">
</div>
<div class="data-card">
<h3>Metadata Tags</h3>
<pre id="output">Processing...</pre>
</div>
</div>
</div>
<script>
const dropZone = document.getElementById('drop-zone');
const fileInput = document.getElementById('file-input');
const output = document.getElementById('output');
const preview = document.getElementById('preview');
const resultsGrid = document.getElementById('results-grid');
dropZone.onclick = () => fileInput.click();
fileInput.onchange = (e) => handleFile(e.target.files[0]);
dropZone.ondragover = (e) => { e.preventDefault(); dropZone.classList.add('hover'); };
dropZone.ondragleave = () => dropZone.classList.remove('hover');
dropZone.ondrop = (e) => {
e.preventDefault();
dropZone.classList.remove('hover');
handleFile(e.dataTransfer.files[0]);
};
function handleFile(file) {
if (!file) return;
resultsGrid.style.display = 'grid';
output.textContent = "Extracting data...";
const reader = new FileReader();
reader.onload = (e) => {
preview.src = e.target.result;
};
reader.readAsDataURL(file);
EXIF.getData(file, function() {
const allMetaData = EXIF.getAllTags(this);
if (Object.keys(allMetaData).length > 0) {
// Filter out large binary blobs like the thumbnail for a cleaner display
const cleanData = { ...allMetaData };
delete cleanData.thumbnail;
output.textContent = JSON.stringify(cleanData, null, 2);
} else {
output.textContent = "No EXIF data found. (Common with screenshots or web-optimized images).";
}
});
}
</script>
</body>
</html>