work in progress
using bootstrap 4, importing fontawesome but not using it yet
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>Image Gallery</title> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> | |
<link href="https://use.fontawesome.com/releases/v5.0.8/css/all.css" rel="stylesheet"> | |
<link href="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.3.0/ekko-lightbox.css" rel="stylesheet"> | |
<style> | |
html { | |
position: relative; | |
min-height: 100%; | |
} | |
body { | |
margin-bottom: 60px; | |
} | |
.footer { | |
position: absolute; | |
bottom: 0; | |
width: 100%; | |
height: 60px; | |
line-height: 60px; | |
background-color: #f5f5f5; | |
} | |
body > .container { | |
padding: 60px 15px 0; | |
} | |
.footer > .container { | |
padding-right: 15px; | |
padding-left: 15px; | |
} | |
.img-div { | |
margin-top: 10px; | |
margin-bottom: 10px; | |
padding: 10px; | |
border-radius: 25px; | |
border: solid 1px #ececec; | |
text-align: center; | |
} | |
.img-div:hover { | |
background-color: #ececec; | |
font-style: initial; | |
font-weight: bold; | |
} | |
.img-div a, .img-div a:hover { | |
text-decoration: none; | |
} | |
.img-div p { | |
font-size: smaller; | |
padding-top: 10px; | |
} | |
</style> | |
</head> | |
<body> | |
<header> | |
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark"> | |
<span class="navbar-brand">Image Gallery</span> | |
</nav> | |
</header> | |
<main role="main" class="container"> | |
<h4><span id="image-count">0</span> Images Found</h4> | |
<div class="row justify-content-center"> | |
<?php | |
$imagecounter = 0; | |
$files = scandir('./'); | |
$uri = "http://".$_SERVER['HTTP_HOST']; | |
foreach ($files as $file) : | |
if (preg_match("/.?\.(jpg|png)$/i", $file)) : | |
$imagecounter += 1; | |
$url = "{$uri}/{$file}"; ?> | |
<div class="col-sm-4 col-md-3"> | |
<div class="img-div"> | |
<a href="<?php echo $url; ?>" data-toggle="lightbox" data-gallery="image-gallery" data-type="image" data-title="<?php echo $file; ?>"> | |
<img src="<?php echo $url; ?>" class="img-fluid img-thumbnail"> | |
<p><?php echo $file; ?></p> | |
</a> | |
</div> | |
</div> | |
<?php endif; | |
endforeach; | |
?> | |
</div> | |
</main> | |
<footer class="footer"> | |
<div class="container"> | |
<span class="text-muted">© Scott Offen 2017</span> | |
</div> | |
</footer> | |
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.3.0/ekko-lightbox.min.js"></script> | |
<script> | |
$(document).ready(function (){ | |
$('#image-count').text("<?php echo $imagecounter; ?>"); | |
}); | |
$(document).on('click', '[data-toggle="lightbox"]', function(event) { | |
event.preventDefault(); | |
$(this).ekkoLightbox(); | |
}); | |
</script> | |
</body> | |
</html> |