/
viewer.php
executable file
·58 lines (45 loc) · 1.61 KB
/
viewer.php
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
51
52
53
54
55
56
57
58
<?php
require_once('config.php');
require_once(DIR_TOOLS.'connect_db.php');
require_once(DIR_INCLUDES.'pagination.php');
$pagination = new Pagination($pdo, IMAGES_PER_PAGE);
$image = $_REQUEST['src'];
$surrounding_items = $pagination->surroundingItems($image,4);
$prev_src = empty($surrounding_items['leading']) ? null : $surrounding_items['leading'][0]['filename'];
$next_src = empty($surrounding_items['trailing']) ? null : $surrounding_items['trailing'][0]['filename'];
$item_type = $surrounding_items['current']['type'];
$item_src = $image;
$gallery_page = $surrounding_items['current']['page_number'];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Image Viewer</title>
<link href="assets/css/main.css" rel="stylesheet" type="text/css" media="screen">
</head>
<body>
<!--h1>Image Viewer</h1-->
<div id="viewer">
<div class="featured">
<?php if ( $item_type == "VIDEO" ) { ?>
<video class="media" src="<?=$item_src;?>" autoplay loop>
This browser doesn't support embedded videos.
</video>
<?php } else { ?>
<img class="media" src="<?=$image;?>" />
<?php } ?>
</div>
<nav class="image-nav">
<a class="prev" href="<?=FILE_VIEWER . "?src=" . $prev_src;?>">Prev</a>
<a class="next" href="<?=FILE_VIEWER . "?src=" . $next_src;?>">Next</a>
</nav>
</div>
<nav id="nav-links">
<a class="gallery" href="<?=FILE_GALLERY."?page=".$gallery_page;?>">Back to Gallery</a>
<a class="surrounding" href="<?=FILE_SURROUND."?src=".$image;?>">Surrounding Images</a>
</nav>
<nav id="thumb-nav">
</nav>
</body>
</html>