-
Notifications
You must be signed in to change notification settings - Fork 0
/
display.php
executable file
·131 lines (121 loc) · 3.66 KB
/
display.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?php
$host = "host = 127.0.0.1";
$port = "port = 5432";
$dbname = "dbname = testdb";
$loginData = file('../.credentials.txt');
foreach ($loginData as $line) {
list($username, $password) = explode(',',$line);
}
$credentials = "user = $username password=$password";
$conn = pg_connect( " $host $port $dbname $credentials" )
or die ("Could not connect to server\n");
$temp = '/tmp/images/';
$query = "select name from image";
$result = pg_query($query);
if($result)
{
echo "<html>
<head>
<title>Lintel</title>
<meta charset=\"utf-8\">
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
<link rel=\"stylesheet\" href=\"bootstrap/css/bootstrap.min.css\">
<link rel=\"stylesheet\" href=\"font-awesome/css/font-awesome.min.css\">
<script src=\"bootstrap/jquery.min.js\"></script>
<script src=\"bootstrap/js/bootstrap.min.js\"></script>
<style>
div.mydiv {
position: fixed;
width: 100%;
height: 100%;
z-index: 10;
background: black;
}
img.preview {
position:absolute;
top:0;
left:0;
right:0;
bottom:0;
margin:auto;
}
#mygalary {
line-height: 0;
-webkit-column-count: 5;
-webkit-column-gap : 0px;
-moz-column-count: 5;
-moz-column-gap: 0px;
column-count: 5;
column-gap: 0px;
}
#mygalary IMG {
width: 100% !important;
height: auto !important;
border : double 1px red;
}
@media (max-width: 1200px) {
#mygalary {
-moz-column-count: 4;
-webkit-column-count: 4;
column-count: 4;
}
}
@media (max-width: 1000px) {
#mygalary {
-moz-column-count: 3;
-webkit-column-count: 3;
column-count: 3;
}
}
@media (max-width: 800px) {
#mygalary {
-moz-column-count: 2;
-webkit-column-count: 2;
column-count: 2;
}
}
</style>
<script type=\"text/javascript\">
function hidefun() {
document.getElementById(\"previewdiv\").style.visibility = 'hidden';
document.getElementById(\"imageviewer\").src = \"Images/loading.gif\";
}
function myfun(id) {
document.getElementById(\"imageviewer\").src = \"show.php?imgFile=${temp}/\" + id;
document.getElementById(\"previewdiv\").style.visibility = 'visible';
}
</script>
</head>
<body style=\"padding-top:70px\">
<div class=\"container mydiv\" id=\"previewdiv\" onclick=\"hidefun();\">
<img id=\"imageviewer\" src=\"\" style=\"max-width:100%\" onclick=\"hidefun();\" title=\"By: LintelBuligingSolutions\" class=\"preview\" />
</div>
<div class=\"container\">"
;
$rowcount = pg_num_rows($result);
if ($rowcount > 0 ) {
echo "<section id=\"mygalary\">";
while ($row = pg_fetch_row($result)) {
$tempDir = $temp . $row[0];
$tempDircpy = $tempDir;
$query2 = "select lo_export(image, '$tempDir') from image where name = '${row[0]}'";
$result2 = pg_query($query2);
if ($result2) {
echo "<IMG SRC=show.php?imgFile=${tempDircpy} id=\"${row[0]}\" title=\"LintelBuligingSolutions\" onclick=\"myfun(this.id)\">";
}
}
echo "</section>";
}
else {
$tempDircpy = $temp . "noimage.png";
echo "<br><br><IMG SRC=show.php?imgFile=${tempDircpy} class=\"img-responsive\" style=\"max-width:100%;margin:0 auto\" align=\"middle\" alt=\"No image found\" ><br><br>";
}
echo "</div><script type=\"text/javascript\">
document.getElementById(\"previewdiv\").style.visibility = 'hidden';
document.getElementById(\"imageviewer\").src = \"Images/loading.gif\";
</script>
</body>
</html>";
}
pg_close($conn);
?>