-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
74 lines (60 loc) · 2.79 KB
/
index.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
<!doctype html>
<head>
<meta charset="utf-8">
<title>image with EXIF orientation demo</title>
<!-- basic styles to reduce images' size -->
<style>
.image {
height: 10em;
}
</style>
</head>
<body>
<p>Demonstrates that the <pre><img></pre> doesn't read the image orientation EXIF meta-tag unless told so by css</p>
<p>but it only works in firefox</p>
<hr>
<!-- put a button to toggle the css orientation property -->
<input id="orientation" type="checkbox">toggle css orientation property to <strong>from-file</strong></input>
<hr>
<!-- include images -->
<ul>
<li>local image without meta-data orientation: <br/>
<img class="image" src="img/tree-orientation-none.jpg"
alt="local image without orientation meta-data"/>
</li>
<li>local image with meta-data orientation: <br/>
<img class="image" src="img/tree-orientation-6.jpg"
alt="local image with orientation meta-data"/>
</li>
<li>web served image with meta-data orientation: <br/>
<img class="image" src="https://loicjaouen.github.io/img-orientation/img/tree-orientation-6.jpg"
alt="web served image with orientation meta-data"/>
</li>
<li>sipi image with meta-data orientation: <br/>
<img class="image" src="http://sipi-demo.unil.ch/knora/EE8XhsWVNCj-Dfu3AzReajj.jpx/full/816,612/0/default.jpg"
alt="sipi image with orientation meta-data from sipi"/>
</li>
</ul>
<hr>
<p>Exif edited with: <a href="https://www.imgonline.com.ua/">imgonline.com.ua</a></p>
<!-- script to listen to the above button and change the image style -->
<script>
var imageOrientation = document.getElementById("orientation");
imageOrientation.addEventListener("change", function (evt) {
var elements = document.getElementsByClassName('image');
for (var i in elements) {
<!-- thin out the dom part that are not images -->
if (elements.hasOwnProperty(i)) {
if (evt.target.checked) {
<!-- if the button is checked, change the orientation to "from-file" -->
elements[i].style.imageOrientation = 'from-image';
} else {
<!-- else put it to "unset" -->
elements[i].style.imageOrientation = 'unset';
}
}
}
});
</script>
</body>
</html>