Handle jpeg orientation in viewer
[bizou.git] / plugins / viewer / template.php
index 7da8acd..03c88d3 100644 (file)
@@ -1,19 +1,20 @@
 <html>
 <head>
-<title> <?php echo IMAGES_DIR.$simpleImagePath ?> </title>
+<title> <?= IMAGES_DIR.$simpleImagePath ?> </title>
 <style type="text/css">
 html, body {
-height: 100%;
+       height: 100%;
 }
 body {
-margin: 0;
-text-align: center;
-background: black;
-color: white;
+       margin: 0;
+       text-align: center;
+       background: black;
+       color: white;
 }
 #theimage {
-max-width: 100%;
-max-height: 100%;
+       max-width: 100%;
+       max-height: 100%;
+       image-orientation: from-image;
 }
 a {
        color: white;
@@ -45,28 +46,28 @@ img {
 </style>
 
 <?php if ($nextImageUrl !== '' and $firefox) { ?>
-<link rel="prefetch" href="<?php echo $nextImageUrl ?>" />
-<link rel="prefetch" href="<?php echo $nextPageUrl ?>" />
+<link rel="prefetch" href="<?= $nextImageUrl ?>" />
+<link rel="prefetch" href="<?= $nextPageUrl ?>" />
 <?php } ?>
 
 </head>
 <body>
 
-<a href="<?php echo $imageUrl ?>"><img src="<?php echo $imageUrl ?>" id="theimage" /></a>
+<a href="<?= $imageUrl ?>"><img src="<?= $imageUrl ?>" id="theimage" /></a>
 
 <div id="up">
-<a href="<?php echo $directoryUrl ?>" title="Back to directory">^</a>
+<a href="<?= $directoryUrl ?>" title="Back to directory">^</a>
 </div>
 
 <?php if ($nextPageUrl !== '') { ?>
 <div id="next">
-<a href="<?php echo $nextPageUrl ?>" title="Next image">&gt;</a>
+<a href="<?= $nextPageUrl ?>" title="Next image">&gt;</a>
 </div>
 <?php } ?>
 
 <?php if ($prevPageUrl !== '') { ?>
 <div id="previous">
-<a href="<?php echo $prevPageUrl ?>" title="Previous image">&lt;</a>
+<a href="<?= $prevPageUrl ?>" title="Previous image">&lt;</a>
 </div>
 <?php } ?>
 
@@ -75,9 +76,9 @@ img {
 <?php if ($nextImageUrl !== '' and ! $firefox) { ?>
 window.onload = function() { // for browsers not supporting link rel=prefetch
        var im = new Image();
-       im.src = '<?php echo $nextImageUrl ?>';
+       im.src = '<?= $nextImageUrl ?>';
        var req = new XMLHttpRequest();
-       req.open('GET', '<?php echo $nextPageUrl ?>', false);
+       req.open('GET', '<?= $nextPageUrl ?>', false);
        req.send(null);
 };
 <?php } ?>
@@ -87,17 +88,17 @@ function keyup(e)
 {
        switch (e.keyCode) {
                case 37: // left
-                       window.location = "<?php echo $prevPageUrl ?>";
+                       window.location = "<?= $prevPageUrl ?>";
                break;
                case 39: // right
                case 32: // space
-                       window.location = "<?php echo $nextPageUrl ?>";
+                       window.location = "<?= $nextPageUrl ?>";
                break;
                case 38: // up  (down is 40)
-                       window.location = "<?php echo $directoryUrl ?>";
+                       window.location = "<?= $directoryUrl ?>";
                break;
                case 13: // enter
-                       window.location = "<?php echo $imageUrl ?>";
+                       window.location = "<?= $imageUrl ?>";
                break;
        }
 }