<?php 

require_once "photos.php";

function getExifData($filename) {

   if (empty($filename)) {
      echo "Ta aplikacja wymaga podania nazwy pliku ze zdjÄciem.";
   }  else {
      $exif = exif_read_data($filename);
   }
return $exif;

}

   $index = $_GET['photo'];
   $uri = $_SERVER['SCRIPT_NAME'];

   if (empty($index)) 
      $index = 0;

   $prev = $index - 1;

   if ($index < (count($photos) - 1)) {
     $next = $index + 1;
   }

   $exif = getExifData($photos[$index]);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="pl">
<head>
<title>Pokaz slajdĂłw</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="slideshow.css" />
<link rel="stylesheet" type="text/css" href="photoslideshow.css" />
</head>
<body>
<div id="slideshow">

<div id="content">
<div id="main">
<img src="<?php echo $photos[$index]; ?>" id="photo" />
</div>
<div id="meta">
<ul id="metacontent">
<?php 

echo "<li>" . $exif['Model'] . "</li>";
echo "<li>" . $exif['ISOSpeedRatings']. "</li>";
echo "<li>" . $exif['ExposureTime'] . "</li>";
echo "<li>" . $exif['DateTimeOriginal'] . "</li>";
echo "<li>" . $exif['Computed']['ApertureFNumber'] . "</li>";
?>
</div>
</div>

<div id="navigation">
<?php if ($prev >= 0) : ?><div id="previous" class="navlink"><a href="<?php echo "$uri?photo=$prev"; ?>">Wstecz</a></div><?php endif; ?> 
<div id="home" class="navlink"><a href="<?php echo $uri ?>?photo=0">Start</a></div>
<?php if (!empty($next)) : ?><div id="next" class="navlink"><a href="<?php echo "$uri?photo=$next"; ?>">Dalej</a></div><?php endif; ?>
</div>

<div id="footer">
</div>
</div>
</body>
</html>
