finalise image page and make images clickable.
This commit is contained in:
parent
2d6cd5e992
commit
5e1b8defd2
4 changed files with 18 additions and 7 deletions
12
image.php
12
image.php
|
@ -2,13 +2,19 @@
|
|||
include 'include/db.php';
|
||||
include 'include/templates.php';
|
||||
|
||||
if (!isset($_GET['id'])) {
|
||||
die("<meta http-equiv=\"refresh\" content=\"0; url=/\">");
|
||||
}
|
||||
|
||||
showHeader();
|
||||
$imgs = getImage(1);
|
||||
$imgs[0]["uploader"] = uuidToUsername($imgs[0]["uploader"]);
|
||||
$imgs = getImage($_GET['id']);
|
||||
if ($imgs == NULL) {
|
||||
die("<meta http-equiv=\"refresh\" content=\"0; url=/\">");
|
||||
}
|
||||
$tags = explode(",", $imgs[0]["tags"]);
|
||||
|
||||
echo '<center><img src="' . $imgs[0]["location"] . '" /></center>';
|
||||
echo '<strong>Uploader:</strong> ' . $imgs[0]["uploader"];
|
||||
echo '<strong>Uploader:</strong> ' . uuidToUsername($imgs[0]["uploader"]);
|
||||
echo '<br/><strong>Tags:</strong>';
|
||||
for($x = 0; $x < count($tags); $x++) {
|
||||
printTag($tags[$x], true);
|
||||
|
|
|
@ -172,7 +172,7 @@ function getImages($page = 0) {
|
|||
|
||||
$t2 = $upperBound-0; // I genuinely have no idea why this works but don't touch it.
|
||||
|
||||
$getStatement = $db->prepare("SELECT location, tags FROM images WHERE id > ? AND id <= ? ORDER BY id DESC LIMIT 10");
|
||||
$getStatement = $db->prepare("SELECT location, tags, id FROM images WHERE id > ? AND id <= ? ORDER BY id DESC LIMIT 10");
|
||||
$getStatement->bindParam(1, $lowerBound, SQLITE3_INTEGER);
|
||||
$getStatement->bindParam(2, $t2, SQLITE3_INTEGER);
|
||||
$result = $getStatement->execute();
|
||||
|
@ -190,7 +190,12 @@ function getImage($id) {
|
|||
|
||||
$getStatement = $db->prepare("SELECT location, uploader, tags FROM images where id = ?");
|
||||
$getStatement->bindParam(1, $id, SQLITE3_INTEGER);
|
||||
|
||||
$result = $getStatement->execute();
|
||||
if ($result->numColumns() == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while ($res = $result->fetchArray(1))
|
||||
{
|
||||
array_push($data, $res);
|
||||
|
|
|
@ -14,8 +14,8 @@ function printTag($tag, $largerFontSize = false) {
|
|||
}
|
||||
}
|
||||
|
||||
function dispImage($imgurl, $tags) {
|
||||
$imgstart = '<div class="thumbnail" style="padding:10px;"><img src="' . $imgurl . '" style="max-height: 200px;"/><br/><div class="details" style="font-size:20px;">';
|
||||
function dispImage($imgurl, $tags, $id) {
|
||||
$imgstart = '<div class="thumbnail" style="padding:10px;"><a href="/image.php?id=' . $id . '" target="_blank"><img src="' . $imgurl . '" style="max-height: 200px;"/></a><br/><div class="details" style="font-size:20px;">';
|
||||
$imgend = '</div></div>';
|
||||
echo "$imgstart";
|
||||
for($x = 0; $x < count($tags); $x++) {
|
||||
|
|
|
@ -5,7 +5,7 @@ include 'include/templates.php';
|
|||
showHeader();
|
||||
$imgs = getImages();
|
||||
for ($i = 0; $i < sizeof($imgs); $i++){
|
||||
dispImage($imgs[$i]["location"], explode(",", $imgs[$i]["tags"]));
|
||||
dispImage($imgs[$i]["location"], explode(",", $imgs[$i]["tags"]), $imgs[$i]["id"]);
|
||||
}
|
||||
echo $footer;
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue