Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8994427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:25:47+00:00 2026-06-15T23:25:47+00:00

I am trying to make a simple gallery script on my page for a

  • 0

I am trying to make a simple gallery script on my page for a photo booth. I have a tethered camera which is dropping pictures into a folder on my local site hosted with MAMP. Each folder is a different groups photos. Path to photos is (‘/images/**‘). First page searches the folders in my images directory and returns only the first image as a thumbnail/link to all folders containing all images for that group of people.

My structure is as follows.

1st page is:

$i = 1;
foreach (glob('images/*') as $dir) {
echo '<div id="strip' . $i . '" class="polaroid">';
// One div per directory                    
$p = 1;
foreach (glob($dir."/*.jpg") as $img) {
$p++;   
if ($p <= 2) {
echo "<a href='$dir'><img  src='$img'/></a>";       
} else {
}}
echo "</div>\n";
$i++;

This part works and takes the user to the directory with jpegs in it. which also contains a index.php file with the following code:

$dir = 'images/'.basename('/'.getcwd()).'/';
foreach (glob($dir."/*.jpg") as $img) 
echo $img;
{
echo "<img  src='$img'/>";      
}

This is where it fails. When I echo out $dir it shows the current relative path, but $dir in the foreach statement seems to be returning empty. This just returns an empty img tag. Any opinions where I am going wrong.

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:25:49+00:00Added an answer on June 15, 2026 at 11:25 pm

    If you want to list the files in the current directory you have to set

    $dir = '.';
    

    You did set $dir to /images/225652/ but you are already in this directory

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I trying to make a simple image gallery, where I have several radio button
excuse me, i'm trying to make simple application which converting the words into word.
Trying to make simple minesweeper game in python, but have one problem. I have
I'm trying to make simple script using jquery $post function to pass data to
I am fairly new to iOS development and trying make a simple app which
I'm trying to make a gallery with highslide. I have two thumbnails, a larger
I'm trying to make simple many-to-one association, using NHibernate.. I have class Recruit with
I was trying to make a javascript gallery script by my own. When i
I'm trying to make a simple jQuery gallery with only 3 images as pictured
I'm trying to make a simple gallery and can't figure out what is wrong

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.