mirror of
https://github.com/Fluffy-Bean/image-gallery.git
synced 2025-06-01 00:03:12 +00:00
Adding modules
This commit is contained in:
parent
dc89737cfc
commit
c8f434e106
10 changed files with 93 additions and 91 deletions
25
search.php
Normal file
25
search.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
if (isset($_GET['q']) && !empty($_GET['q'])) {
|
||||
// Make search into an array
|
||||
$search_array = explode(" ", $_GET['q']);
|
||||
|
||||
// Get images tags for comparing
|
||||
$image_tag_array = explode(" ", $image['tags']);
|
||||
|
||||
// Compare arrays
|
||||
$compare_results = array_intersect($image_tag_array, $search_array);
|
||||
if (count($compare_results) > 0) {
|
||||
// Getting thumbnail
|
||||
if (file_exists("images/thumbnails/".$image['imagename'])) {
|
||||
$image_path = "images/thumbnails/".$image['imagename'];
|
||||
} else {
|
||||
$image_path = "images/".$image['imagename'];
|
||||
}
|
||||
|
||||
// Image loading
|
||||
echo "<div class='gallery-item'>";
|
||||
echo "<a href='image.php?id=".$image['id']."'><img class='gallery-image' loading='lazy' src='".$image_path."' id='".$image['id']."'></a>";
|
||||
echo "</div>";
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue