-
Notifications
You must be signed in to change notification settings - Fork 4
/
cmark_resizer.html
50 lines (46 loc) · 1.36 KB
/
cmark_resizer.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
<html>
<head>
<style>
html, body {
background: transparent;
margin: 0;
padding: 0;
overflow: hidden;
}
#mainimage {
max-width: 1024;
height: auto;
width: 100%;
margin: 0;
padding: 0;
max-height: 1024;
}
#imgdiv {
width: 1024;
height: 1024;
overflow: hidden;
margin: 0;
padding: 0;
text-align: center;
}
</style>
<script>
window.onload = function() {
var img = document.getElementById('mainimage');
if (img.naturalWidth < img.naturalHeight) {
img.style.setProperty('height', '100%');
img.style.setProperty('width', 'auto');
}
img.style.setProperty('margin-top', (1024 - img.height) / 2);
setInterval(function() {
console.log('FRAME');
}, 50);
};
</script>
</head>
<body>
<div id='imgdiv'>
<img src='https://dbot.serealia.ca/custom/content/materials/sweetiebot/body.png' id='mainimage' />
</div>
</body>
</html>