-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.php
86 lines (58 loc) · 1.9 KB
/
script.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!DOCTYPE html>
<html>
<head>
<title>Lightbox Auto Image Adder</title>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- At first call the Lightbox Stylesheet from CDN -->
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.8.2/css/lightbox.min.css">
<!-- /At first call the Lightbox Stylesheet from CDN -->
</head>
<body>
<!-- =========================================
Put The Script Below and Keep The
Images in a Folder named "lb_gallery"
======================================== -->
<div class="lb_gallery">
<?php
$Folder_Name = "lightbox_images";
$images = glob("$Folder_Name/*.{jpg,png,gif}", GLOB_BRACE);
foreach($images as $image){
echo '<a href="'.$image.'" data-lightbox="auto_lightbox">
<img class="lb_img" src="' .$image. '" alt="">
</a>';
}
?>
</div>
<!-- =========================================
/Put The Script Below and Keep The
Images in a Folder named "lb_gallery"
======================================== -->
<!-- =========================================
Use CSS to Stylize
======================================== -->
<style>
.lb_gallery{
width: 800px;
margin:auto;
}
.lb_img{
height: 120px;
width: 120px;
margin: 10px;
border: #fff 3px solid;
}
</style>
<!-- =========================================
/Use CSS to Stylize
======================================== -->
</body>
<!-- Call the jQuery and Lightbox Script from CDN-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.8.2/js/lightbox.min.js">
</script>
<!-- /Call the jQuery and Lightbox Script from CDN-->
<!-- And it's Done! -->
</html>