'How to get and display images from a certain gallery Albums?

I am creating a personal website. I was able to add images and create gallery albums on the admin page of my website meanwhile on my web visitor's page, the gallery albums are showing however I want the images that I uploaded on a specific album in the admin page to appear in the front-end when a visitor clicks on a certain gallery album. How can I make this possible using php?

I've tried this code but it didn't work.

<?php
$result = array();
$dir = 'photo-album/';
foreach(glob($dir. '*.jpg') as $filename){

    $result[] = "<div class=\box\"><img src=\$filename\"></div>";
}  
  ?>

By the way, those gallery albums and photos that I've created and added on the back-end doesn't have a database rather it is directly save on my localhost directory folder that I've created which contains all the gallery albums that I have on the admin page.

php


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source