Permalink
Browse files

Allow automatic load on refresh and make parsing errors more obvious.

  • Loading branch information...
1 parent 240644a commit 9d6e3c5b68db1898ea2efa91df2dbda79c61a827 @GPHemsley committed Nov 21, 2012
Showing with 5 additions and 4 deletions.
  1. +5 −4 test.html
View
9 test.html
@@ -10,9 +10,10 @@
<script type="text/javascript">
"use strict";
var prepareTIFF = function() {
- var file = document.getElementById( "tiff-file" ).files[0];
+ var files = document.getElementById( "tiff-file" ).files;
+ var file = files[0];
- if (file.type !== 'image/tiff') {
+ if (files.length < 1 || file.type !== 'image/tiff') {
return;
}
@@ -33,7 +34,7 @@
}
</script>
</head>
-<body>
+<body onload="prepareTIFF();">
<form name="tiff-parser" method="post" enctype="multipart/form-data" style="margin: 10% auto auto; text-align: center;">
@@ -42,7 +43,7 @@
</form>
-<canvas id="tiff-image" style="display: block; max-width: 95%; margin: 2em auto; border: 1px dashed magenta; padding: 0px; background-color: black"></canvas>
+<canvas id="tiff-image" style="display: block; max-width: 95%; margin: 2em auto; border: 1px dashed magenta; padding: 0px; background-color: #FFEEFF;"></canvas>
</body>
</html>

0 comments on commit 9d6e3c5

Please sign in to comment.