90 lines
3.0 KiB
HTML
90 lines
3.0 KiB
HTML
<!DOCTYPE html>
|
|
<style>
|
|
div.container {
|
|
display: inline-block;
|
|
margin-right: 20px;
|
|
margin-bottom: 10px;
|
|
width: 100px;
|
|
vertical-align: top;
|
|
}
|
|
div.horizontal {
|
|
width: 100px;
|
|
height: 50px;
|
|
}
|
|
div.vertical {
|
|
width: 50px;
|
|
height: 100px;
|
|
}
|
|
</style>
|
|
<body>
|
|
<b>The images of the composited <img> elements should be rotated respecting their EXIF orientation.</b>
|
|
<br>
|
|
<br>
|
|
<div class="container">
|
|
<div class="horizontal">
|
|
<img id="img2" src="resources/exif-orientation-1-ul.jpg" style="transform: scaleX(-1);">
|
|
</div>
|
|
<br>Flipped horizontally
|
|
</div>
|
|
<div class="container">
|
|
<div class="horizontal">
|
|
<img id="img3" src="resources/exif-orientation-1-ul.jpg" style="transform: rotate(180deg);">
|
|
</div>
|
|
<br>Rotated 180°
|
|
</div>
|
|
<div class="container">
|
|
<div class="horizontal">
|
|
<img id="img4" src="resources/exif-orientation-1-ul.jpg" style="transform: scaleX(-1) rotate(180deg);">
|
|
</div>
|
|
<br>Flipped vertically
|
|
</div>
|
|
<br>
|
|
<div class="container">
|
|
<div class="vertical">
|
|
<img id="img5" src="resources/exif-orientation-1-ul.jpg" style="transform: translate(-25px, 25px) rotate(90deg) scaleY(-1);">
|
|
</div>
|
|
<br>Rotated 90° CCW and flipped vertically
|
|
</div>
|
|
<div class="container">
|
|
<div class="vertical">
|
|
<img id="img6" src="resources/exif-orientation-1-ul.jpg" style="transform: translate(-25px, 25px) rotate(90deg);">
|
|
</div>
|
|
<br>Rotated 90° CCW
|
|
</div>
|
|
<div class="container">
|
|
<div class="vertical">
|
|
<img id="img7" src="resources/exif-orientation-1-ul.jpg" style="transform: translate(-25px, 25px) rotate(270deg) scaleY(-1);">
|
|
</div>
|
|
<br>Rotated 90° CW and flipped vertically
|
|
</div>
|
|
<div class="container">
|
|
<div class="vertical">
|
|
<img id="img8" src="resources/exif-orientation-1-ul.jpg" style="transform: translate(-25px, 25px) rotate(270deg);">
|
|
</div>
|
|
<br>Rotated 90° CW
|
|
</div>
|
|
<br>
|
|
<ul id="console"></ul>
|
|
<script>
|
|
function log(str) {
|
|
var li = document.createElement("li");
|
|
li.appendChild(document.createTextNode(str));
|
|
var console = document.getElementById("console");
|
|
console.appendChild(li);
|
|
}
|
|
|
|
function imageSize(index) {
|
|
var element = document.getElementById("img" + index);
|
|
var computedStyle = window.getComputedStyle(element);
|
|
if (element.parentElement.classList.contains("vertical"))
|
|
return computedStyle.height + " by " + computedStyle.width;
|
|
return computedStyle.width + " by " + computedStyle.height;
|
|
}
|
|
|
|
window.addEventListener('load', (event) => {
|
|
for(var i = 2; i <= 8; i++)
|
|
log("img" + i + " size = " + imageSize(i));
|
|
});
|
|
</script>
|
|
</body>
|